/** * Returns the single instance of this class. * * @return WSStorage * The single instance of this class. */ public static function getInstance() { if (!isset(self::$mInstance)) { $c = __CLASS__; self::$mInstance = new $c(); } return self::$mInstance; }
function smwfDIInitializeTables() { global $smwgDIIP; require_once $smwgDIIP . '/specials/WebServices/SMW_WebServiceManager.php'; WebServiceManager::initDatabaseTables(); require_once $smwgDIIP . '/specials/Materialization/SMW_MaterializationStorageAccess.php'; $dbAccess = SMWMaterializationStorageAccess::getInstance(); $db = $dbAccess->getDatabase(); $db->setup(true); return true; }
/** * Setup database for Data Import extension. * * @author: Ingo Steinbauer * * Created on: 17.07.2009 */ if (array_key_exists('SERVER_NAME', $_SERVER) && $_SERVER['SERVER_NAME'] != NULL) { echo "Invalid access! A maintenance script MUST NOT accessed from remote."; return; } $mediaWikiLocation = dirname(__FILE__) . '/../../..'; require_once "{$mediaWikiLocation}/maintenance/commandLine.inc"; global $smwgDIIP; $smwgDIIP = "{$mediaWikiLocation}/extensions/DataImport"; $help = array_key_exists("h", $options); $delete = array_key_exists("delete", $options) || array_key_exists("d", $options); if ($help) { echo "\nUsage: php DI_setup.php --h | --d \n"; echo "Started with no parameters installs the database tables."; die; } require_once $smwgDIIP . "/specials/WebServices/SMW_WSStorage.php"; require_once $smwgDIIP . "/specials/Materialization/SMW_MaterializationStorageAccess.php"; if ($delete) { WSStorage::getDatabase()->deleteDatabaseTables(); SMWMaterializationStorageAccess::getDatabase()->deleteDatabaseTables(); } else { WSStorage::getDatabase()->initDatabaseTables(); SMWMaterializationStorageAccess::getDatabase()->setup(true); }
/** * method is called in the article save complete and * the delete hook. it checks for saved materializations * which can be removed from the database * * @param $articleId */ function materializePF_updateDB($articleId) { global $wgsmwRememberedMaterializations; $dbAccess = SMWMaterializationStorageAccess::getInstance(); $db = $dbAccess->getDatabase(); $savedMaterializations = $db->getCallHashes($articleId); foreach ($savedMaterializations as $sourceHash => $dontCare) { if (!array_key_exists($sourceHash, $wgsmwRememberedMaterializations)) { $db->deleteMaterializationHash($articleId, $sourceHash); } } $wgsmwRememberedMaterializations = array(); }