first upgrade to 6.x

This commit is contained in:
MaxBUhe 2021-03-02 10:47:39 +01:00
parent 4816c2b95d
commit 95e6e77f56
1 changed files with 42 additions and 29 deletions

View File

@ -1,5 +1,10 @@
<?php <?php
use OxidEsales\Eshop\Core\DatabaseProvider;
use OxidEsales\Eshop\Core\Exception\DatabaseConnectionException;
use OxidEsales\Eshop\Core\Exception\DatabaseErrorException;
use OxidEsales\Eshop\Core\Registry;
include(__DIR__ . '/bootstrap.php'); include(__DIR__ . '/bootstrap.php');
/** /**
@ -42,6 +47,7 @@ class deletePictures extends oxSuperCfg
/** /**
* @throws oxConnectionException * @throws oxConnectionException
* @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public function render() public function render()
{ {
@ -515,11 +521,11 @@ class deletePictures extends oxSuperCfg
/** /**
* @return array * @return array
* @throws oxConnectionException * @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public function getLostPicturesSlotsFromTable() public function getLostPicturesSlotsFromTable()
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
select d3folder from d3lostpictures select d3folder from d3lostpictures
@ -565,7 +571,7 @@ MYSQL;
* @param $sSlot * @param $sSlot
* *
* @return array * @return array
* @throws oxConnectionException * @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public function getAllPicturesFromTable($sSlot) public function getAllPicturesFromTable($sSlot)
{ {
@ -575,7 +581,7 @@ MYSQL;
$sPictureDbField = 'ox'.$sSlot; $sPictureDbField = 'ox'.$sSlot;
} }
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
select {$sPictureDbField} from oxarticles where {$sPictureDbField} != '' select {$sPictureDbField} from oxarticles where {$sPictureDbField} != ''
@ -713,10 +719,11 @@ MYSQL;
* *
* @return mixed * @return mixed
* @throws oxConnectionException * @throws oxConnectionException
* @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public function getLostPictures($sSlot) public function getLostPictures($sSlot)
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb(oxDb::FETCH_MODE_ASSOC);
/* /*
$sPictureDbField = 'oxpic'.$sSlot; $sPictureDbField = 'oxpic'.$sSlot;
@ -751,11 +758,11 @@ MYSQL;
* @param $sSlot * @param $sSlot
* *
* @return false|string * @return false|string
* @throws oxConnectionException * @throws DatabaseConnectionException
*/ */
public function getCountLostPictures($sSlot) public function getCountLostPictures($sSlot)
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
select count(oxid) as files from d3lostpictures select count(oxid) as files from d3lostpictures
@ -769,6 +776,7 @@ MYSQL;
/** /**
* @return array * @return array
* @throws oxConnectionException * @throws oxConnectionException
* @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public function getLostPictureGroupByFolder() public function getLostPictureGroupByFolder()
{ {
@ -777,7 +785,7 @@ MYSQL;
return array(); return array();
} }
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
select d3folder, count(oxid) as files, sum(d3filesize) as size from d3lostpictures select d3folder, count(oxid) as files, sum(d3filesize) as size from d3lostpictures
@ -800,7 +808,7 @@ MYSQL;
* @param $sSlot * @param $sSlot
* *
* @return false|string * @return false|string
* @throws oxConnectionException * @throws DatabaseConnectionException
*/ */
public function getCountLostPictureGroupByFolder($sSlot) public function getCountLostPictureGroupByFolder($sSlot)
{ {
@ -809,7 +817,7 @@ MYSQL;
$sPictureDbField = 'ox'.$sSlot; $sPictureDbField = 'ox'.$sSlot;
} }
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
select count(oxid) from select count(oxid) from
@ -1065,11 +1073,11 @@ MYSQL;
* @param $sSlot * @param $sSlot
* *
* @return string * @return string
* @throws oxConnectionException * @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public function deleteLostPictures($sSlot) public function deleteLostPictures($sSlot)
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
SELECT oxid, D3FILENAME as File SELECT oxid, D3FILENAME as File
@ -1133,11 +1141,11 @@ MYSQL;
* @param $sSlot * @param $sSlot
* *
* @return object * @return object
* @throws oxConnectionException * @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public function deleteStartStopFlag($sSlot) public function deleteStartStopFlag($sSlot)
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
DELETE FROM `d3lostpictures` DELETE FROM `d3lostpictures`
@ -1151,11 +1159,11 @@ MYSQL;
* @param $sSlot * @param $sSlot
* *
* @return false|string * @return false|string
* @throws oxConnectionException * @throws DatabaseConnectionException
*/ */
public function hasFinishedImport($sSlot) public function hasFinishedImport($sSlot)
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
SELECT count(oxid) as countflag FROM `d3lostpictures` SELECT count(oxid) as countflag FROM `d3lostpictures`
@ -1175,11 +1183,11 @@ MYSQL;
/** /**
* @return array * @return array
* @throws oxConnectionException * @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public function checkAllSlotsIfFinished() public function checkAllSlotsIfFinished()
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
SELECT d3folder, count(oxid) as countflag FROM `d3lostpictures` SELECT d3folder, count(oxid) as countflag FROM `d3lostpictures`
@ -1260,7 +1268,7 @@ MYSQL;
/** /**
* @return bool * @return bool
* @throws oxConnectionException * @throws DatabaseConnectionException
*/ */
public function tableExist() public function tableExist()
{ {
@ -1288,11 +1296,12 @@ class setupDeletePicturesTable extends oxSuperCfg
public $_sTable = 'd3lostpictures'; public $_sTable = 'd3lostpictures';
/** /**
* @throws oxConnectionException * @throws DatabaseConnectionException
* @throws DatabaseErrorException
*/ */
public static function createTable() public static function createTable()
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
@ -1321,11 +1330,11 @@ MYSQL;
} }
/** /**
* @throws oxConnectionException * @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public static function dropTable() public static function dropTable()
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
Drop table `d3lostpictures`; Drop table `d3lostpictures`;
@ -1337,11 +1346,11 @@ MYSQL;
/** /**
* @param $sSlot * @param $sSlot
* *
* @throws oxConnectionException * @throws DatabaseConnectionException|DatabaseErrorException
*/ */
public static function truncateTable($sSlot) public static function truncateTable($sSlot)
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = $sQuery =
<<<MYSQL <<<MYSQL
TRUNCATE `d3lostpictures`; TRUNCATE `d3lostpictures`;
@ -1361,11 +1370,11 @@ MYSQL;
/** /**
* @return bool * @return bool
* @throws oxConnectionException * @throws DatabaseConnectionException
*/ */
public static function tableExist() public static function tableExist()
{ {
$oDb = oxDb::getDb(oxDb::FETCH_MODE_ASSOC); $oDb = DatabaseProvider::getDb('FETCH_MODE_ASSOC');
$sQuery = <<<MYSQL $sQuery = <<<MYSQL
SHOW TABLES LIKE 'd3lostpictures'; SHOW TABLES LIKE 'd3lostpictures';
MYSQL; MYSQL;
@ -1376,8 +1385,12 @@ MYSQL;
/** @var deletePictures $oBilderLesen */ /** @var deletePictures $oBilderLesen */
$oDeletePictures = oxNew('deletePictures'); $oDeletePictures = oxNew('deletePictures');
$sAction = oxRegistry::getConfig()->getRequestParameter('action'); $oRegistry = oxNew(Registry::getConfig());
$sParameter = oxRegistry::getConfig()->getRequestParameter('parameter');
$sAction = $oRegistry->getRequestParameter('action');
$sParameter = $oRegistry->getRequestParameter('parameter');
if(trim($sAction) != '') if(trim($sAction) != '')
{ {
$oDeletePictures->{$sAction}($sParameter); $oDeletePictures->{$sAction}($sParameter);