From: Brion Vibber Date: Mon, 8 Feb 2010 23:32:20 +0000 (-0800) Subject: Allow scripts/decache.php to blow out cache for objects that don't exist (anymore). X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=96ef4435b61570dbbf15d921a42543bfb13786c0;p=quix0rs-gnu-social.git Allow scripts/decache.php to blow out cache for objects that don't exist (anymore). May miss keys other than the given or primary key, but should work for a lot of common cases where a bad entry's been removed from DB but lingers in cache. --- diff --git a/scripts/decache.php b/scripts/decache.php index 7cabd78ada..094bdb5aa0 100644 --- a/scripts/decache.php +++ b/scripts/decache.php @@ -24,6 +24,8 @@ $helptext = << [] Clears the cache for the object in table with id If is specified, use that instead of 'id' + + ENDOFHELP; require_once INSTALLDIR.'/scripts/commandline.inc'; @@ -43,8 +45,10 @@ if (count($args) > 2) { $object = Memcached_DataObject::staticGet($table, $column, $id); if (!$object) { - print "No such '$table' with $column = '$id'.\n"; - exit(1); + print "No such '$table' with $column = '$id'; it's possible some cache keys won't be cleared properly.\n"; + $class = ucfirst($table); + $object = new $class(); + $object->column = $id; } $result = $object->decache();