diff --git a/scripts/fixup_notices_rendered.php b/scripts/fixup_notices_rendered.php deleted file mode 100755 index cfbdc7479b..0000000000 --- a/scripts/fixup_notices_rendered.php +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/env php -. - */ - -// Abort if called from a web server -if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { - print "This script must be run from the command line\n"; - exit(); -} - -define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -define('STATUSNET', true); -define('LACONICA', true); // compatibility - -require_once(INSTALLDIR . '/lib/common.php'); - -common_log(LOG_INFO, 'Starting to render old notices.'); - -$start_at = ($argc > 1) ? $argv[1] : null; - -$notice = new Notice(); -if ($start_at) { - $notice->whereAdd('id >= ' . $start_at); -} -$cnt = $notice->find(); - -while ($notice->fetch()) { - common_log(LOG_INFO, 'Pre-rendering notice #' . $notice->id); - $original = clone($notice); - $notice->rendered = common_render_content($notice->content, $notice); - $result = $notice->update($original); - if (!$result) { - common_log_db_error($notice, 'UPDATE', __FILE__); - } -} diff --git a/scripts/upgrade.php b/scripts/upgrade.php new file mode 100755 index 0000000000..2c34ae0e47 --- /dev/null +++ b/scripts/upgrade.php @@ -0,0 +1,86 @@ +#!/usr/bin/env php +. + */ + +define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); + +$shortoptions = 'x::'; +$longoptions = array('extensions='); + +$helptext = << $def) { + $schemaUpdater->register($table, $def); + } + $schemaUpdater->checkSchema(); +} + +function updateSchemaPlugins() +{ + printfnq("Upgrading plugin schema"); + + Event::handle('CheckSchema'); +} + +function fixupNoticesRendered() +{ + printfnq("Ensuring all notices have rendered HTML"); + + $notice = new Notice(); + + $notice->whereAdd('rendered IS NULL'); + $notice->find(); + + while ($notice->fetch()) { + $original = clone($notice); + $notice->rendered = common_render_content($notice->content, $notice); + $notice->update($original); + } +} + +main();