Skip to content

Instantly share code, notes, and snippets.

@KristianH
Last active May 2, 2019 11:08
Show Gist options
  • Save KristianH/02b1d1b3262d9b138b49 to your computer and use it in GitHub Desktop.
Save KristianH/02b1d1b3262d9b138b49 to your computer and use it in GitHub Desktop.
<?php
//WARNING: this file deletes content from DB! be careful!
// Use this in a oxid e-sales shop 4.7.0 or higher
//if you are aware of the risks, remove or comment the next line:
die('Please read the comments!');
include('bootstrap.php');
$aDeletes = array(
'oxcategory',
'oxvendor',
'oxmanufacturer',
'oxattribute',
'oxarticle',
'oxselectlist',
);
foreach ($aDeletes AS $class) {
/** @var oxBase $oEntity */
$oEntity = oxNew($class);
$aOxIds = oxDB::getDb(oxDb::FETCH_MODE_ASSOC)->getAll("SELECT oxid FROM {$oEntity->getCoreTableName()}");
foreach ($aOxIds as $sId) {
$oEntity->delete($sId['oxid']);
}
echo $oEntity->getClassName() . ': ' . count($aOxIds) . PHP_EOL;
}
@KatoPue
Copy link

KatoPue commented Dec 10, 2014

So, pull requests are not available for gist...
I would like you to review and merge the changes i have made in my fork of this gist.

@KristianH
Copy link
Author

Thankyou @KatoPue for your suggestion, I take over your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment