} catch (InvalidOwnSettingsSettingException $x) { echo "There is an error in your ownsettings.php" . PHP_EOL . PHP_EOL; echo $x->getMessage() . PHP_EOL; die; } # InvalidOwnSettingsSetting require_once "lib/SpotTiming.php"; require_once "lib/exceptions/ParseSpotXmlException.php"; require_once "lib/exceptions/NntpException.php"; /* * disable timing, all queries which are ran by retrieve this would make it use * large amounts of memory */ SpotTiming::disable(); # Initialize commandline arguments SpotCommandline::initialize(array('force', 'debug', 'retro'), array('force' => false, 'debug' => false, 'retro' => false)); # Initialize translation to english SpotTranslation::initialize('en_US'); # in safe mode, max execution time cannot be set, warn the user if (ini_get('safe_mode')) { echo "WARNING: PHP safemode is enabled, maximum execution cannot be reset! Turn off safemode if this causes problems" . PHP_EOL . PHP_EOL; } # if try { $db = new SpotDb($settings['db']); $db->connect(); } catch (DatabaseConnectionException $x) { die("Unable to connect to database: " . $x->getMessage() . PHP_EOL); } # catch # Creer het settings object
*/ if (@(!file_exists(getcwd() . '/' . basename($argv[0])))) { chdir(dirname(__FILE__)); } # if require_once "lib/SpotClassAutoload.php"; SpotClassAutoload::register(); require_once "lib/Bootstrap.php"; /* * Create a DAO factory. We cannot use the bootstrapper here, * because it validates for a valid settings etc. version. */ $bootstrap = new Bootstrap(); list($settings, $daoFactory, $req) = $bootstrap->boot(); # Initialize commandline arguments SpotCommandline::initialize(array('clean'), array('clean' => false)); # Truncate the current collections tables, and reset all collection id's if (SpotCommandline::get('clean')) { $dbConnection = $daoFactory->getConnection(); echo "Cleaning up all existing collections, "; $dbConnection->rawExec('UPDATE spots SET collectionid = NULL WHERE collectionid IS NOT NULL'); $dbConnection->rawExec('TRUNCATE collections'); $dbConnection->rawExec('TRUNCATE mastercollections'); echo "done." . PHP_EOL; } // if /* Load the complete collection cache in memory */ echo "Loading all existing collections in memory, "; $daoFactory->getCollectionsDao()->loadCollectionCache(array()); echo "done" . PHP_EOL; /* And start creating ocllections */
/* * If we are run from another directory, try to change the current * working directory to a directory the script is in */ if (@(!file_exists(getcwd() . '/' . basename($argv[0])))) { chdir(dirname(__FILE__)); } # if require_once "lib/SpotClassAutoload.php"; SpotClassAutoload::register(); require_once "lib/Bootstrap.php"; /* * Make sure we are not run from the server, an db upgrade can take too much time and * will easily be aborted by either a database, apache or browser timeout */ SpotCommandline::initialize(array('reset-groupmembership', 'reset-securitygroups', 'reset-filters'), array('reset-groupmembership' => false, 'reset-securitygroups' => false, 'reset-filters' => false, 'set-systemtype' => false, 'reset-password' => false, 'mass-userprefchange' => false)); if (!SpotCommandline::isCommandline()) { die("upgrade-db.php can only be run from the console, it cannot be run from the web browser"); } # if /* * Create a DAO factory. We cannot use the bootstrapper here, * because it validates for a valid settings etc. version. */ $bootstrap = new Bootstrap(); $daoFactory = $bootstrap->getDaoFactory(); $settings = $bootstrap->getSettings($daoFactory, false); $dbSettings = $bootstrap->getDbSettings(); /* * And actually start updating or creating the schema and settings */
# if require_once "lib/SpotClassAutoload.php"; SpotClassAutoload::register(); /* * Initialize the Spotweb base classes */ $bootstrap = new Bootstrap(); list($settings, $daoFactory, $req) = $bootstrap->boot(); $spotDao = $daoFactory->getSpotDao(); /* * disable timing, all queries which are ran by retrieve this would make it use * large amounts of memory */ SpotTiming::disable(); # Initialize commandline arguments SpotCommandline::initialize(array('reallyforce', 'debug', 'retro', 'timing'), array('reallyforce' => false, 'timing' => false, 'debug' => false, 'retro' => false)); # Allow for timing to be displayed after retrieval of spots $showTiming = SpotCommandline::get('timing'); if ($showTiming) { SpotTiming::enable(); SpotTiming::enableHtml(false); SpotTiming::disableExtra(true); } # if # Initialize translation to english SpotTranslation::initialize('en_US'); /* * When PHP is running in safe mode, max execution time cannot be set, * which is necessary on slow systems for retrieval and statistics generation */ if (ini_get('safe_mode')) {