Created
February 18, 2016 13:57
-
-
Save brusch/0644af7f63ddb792e495 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include("../../pimcore/cli/startup.php"); | |
$db = Pimcore\Resource::get(); | |
$tables = $db->fetchAll("SHOW TABLES LIKE 'object_localized_query_%'"); | |
echo "\n\n"; | |
foreach ($tables as $table) { | |
$t = current($table); | |
preg_match("/object_localized_query_([0-9]+)_/", $t, $matches); | |
$classId = $matches[1]; | |
echo "Cleaning up " . $t . " ..."; | |
$db->query("DELETE FROM " . $t . " WHERE ooo_id NOT IN (SELECT o_id FROM objects WHERE o_classId = " . $classId . ")"); | |
echo "done!\n"; | |
} | |
echo "\n\n"; | |
echo "Done!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment