2009-01-25 18:28:25 +00:00
|
|
|
#!/usr/bin/env php
|
|
|
|
<?php
|
|
|
|
/*
|
2009-08-25 23:12:20 +01:00
|
|
|
* StatusNet - a distributed open-source microblogging tool
|
|
|
|
* Copyright (C) 2009, StatusNet, Inc.
|
2009-01-25 18:28:25 +00:00
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Affero General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
|
|
|
|
|
2009-06-23 00:52:59 +01:00
|
|
|
$helptext = <<<ENDOFHELP
|
|
|
|
USAGE: decache.php <table> <id> [<column>]
|
|
|
|
Clears the cache for the object in table <table> with id <id>
|
|
|
|
If <column> is specified, use that instead of 'id'
|
|
|
|
ENDOFHELP;
|
2009-01-25 18:28:25 +00:00
|
|
|
|
2009-06-23 00:52:59 +01:00
|
|
|
require_once INSTALLDIR.'/scripts/commandline.inc';
|
|
|
|
|
|
|
|
if (count($args) < 2 || count($args) > 3) {
|
|
|
|
show_help();
|
2009-01-25 18:28:25 +00:00
|
|
|
}
|
|
|
|
|
2009-06-23 00:52:59 +01:00
|
|
|
$table = $args[0];
|
|
|
|
$id = $args[1];
|
|
|
|
if (count($args) > 2) {
|
|
|
|
$column = $args[2];
|
2009-01-25 18:28:25 +00:00
|
|
|
} else {
|
2009-06-23 00:52:59 +01:00
|
|
|
$column = 'id';
|
2009-01-25 18:28:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$object = Memcached_DataObject::staticGet($table, $column, $id);
|
|
|
|
|
|
|
|
if (!$object) {
|
|
|
|
print "No such '$table' with $column = '$id'.\n";
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
$result = $object->decache();
|