} if (!is_dir($SYSTEM_ROOT) || !is_readable($SYSTEM_ROOT . '/core/include/init.inc')) { echo "ERROR: Path provided doesn't point to a Matrix installation's System Root. Please provide correct path and try again.\n"; exit; } require_once $SYSTEM_ROOT . '/core/include/init.inc'; $root_user = $GLOBALS['SQ_SYSTEM']->am->getSystemAsset('root_user'); if (!$GLOBALS['SQ_SYSTEM']->setCurrentUser($root_user)) { trigger_error("Failed logging in as root user\n", E_USER_ERROR); } echo "\n"; $db_type = MatrixDAL::getDbType(); $GLOBALS['SQ_SYSTEM']->changeDatabaseConnection('db2'); $GLOBALS['SQ_SYSTEM']->doTransaction('BEGIN'); $sql = 'SELECT urlid, url, assetid FROM sq_ast_url'; $root_urls = MatrixDAL::executeSqlGroupedAssoc($sql); ksort($root_urls); foreach ($root_urls as $urlid => $url) { echo $urlid . '. ' . $root_urls[$urlid][0]['url'] . "\n"; } echo "\n"; $chosen_url = -1; while (!in_array($chosen_url, array_keys($root_urls))) { $chosen_url = get_line('Please enter the urlid of the url to change: '); if (!in_array($chosen_url, array_keys($root_urls))) { echo 'Invalid urlid!' . "\n"; } } $from_url = $root_urls[$chosen_url][0]['url']; $from_urlid = $chosen_url; $from_site_assetid = $root_urls[$chosen_url][0]['assetid'];