Ejemplo n.º 1
0
 public static function singleton()
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     return self::$instance;
 }
Ejemplo n.º 2
0
 /**
  * 
  * @return array
  */
 public function fileAccessProviders()
 {
     $ext = common_ext_ExtensionsManager::singleton()->getExtensionById('tao');
     if (is_null(self::$fileSystem)) {
         $serviceManager = ServiceManager::getServiceManager();
         $fsm = $serviceManager->get(FileSystemService::SERVICE_ID);
         $fsId = core_kernel_uri_UriService::singleton()->generateUri();
         $fsm->registerLocalFileSystem($fsId, $ext->getConstant('DIR_VIEWS'));
         $serviceManager->register(FileSystemService::SERVICE_ID, $fsm);
         self::$fileSystem = new core_kernel_fileSystem_FileSystem($fsId);
     }
     return array(array(DirectWebSource::spawnWebsource(self::$fileSystem->getUri(), $ext->getConstant('BASE_WWW'))), array(TokenWebSource::spawnWebsource(self::$fileSystem->getUri(), self::$fileSystem->getPath())), array(ActionWebSource::spawnWebsource(self::$fileSystem->getUri())));
 }
Ejemplo n.º 3
0
 /**
  * 
  * @param string $currentVersion
  * @return string $versionUpdatedTo
  */
 public function update($initialVersion)
 {
     $currentVersion = $initialVersion;
     if ($currentVersion == '2.7') {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'widgetdefinitions_2.7.1.rdf';
         $api = core_kernel_impl_ApiModelOO::singleton();
         $success = $api->importXmlRdf('http://www.tao.lu/datatypes/WidgetDefinitions.rdf', $file);
         if ($success) {
             $currentVersion = '2.7.1';
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($currentVersion == '2.7.1') {
         $file = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'widgetdefinitions_2.7.2.rdf';
         $api = core_kernel_impl_ApiModelOO::singleton();
         $success = $api->importXmlRdf('http://www.tao.lu/datatypes/WidgetDefinitions.rdf', $file);
         if ($success) {
             $currentVersion = '2.7.2';
         } else {
             common_Logger::w('Import failed for ' . $file);
         }
     }
     if ($currentVersion == '2.7.2') {
         $implClass = common_ext_ExtensionsManager::singleton()->getExtensionById('generis')->getConfig(PermissionManager::CONFIG_KEY);
         if (is_string($implClass)) {
             if (class_exists($implClass)) {
                 $impl = new $implClass();
                 PermissionManager::setPermissionModel($impl);
                 $currentVersion = '2.7.3';
             } else {
                 common_Logger::w('Unexpected permission manager config type: ' . gettype($implClass));
             }
         } else {
             common_Logger::w('Unexpected permission manager config type: ' . gettype($implClass));
         }
     }
     if ($currentVersion == '2.7.3') {
         ModelManager::setModel(new \core_kernel_persistence_smoothsql_SmoothModel(array(\core_kernel_persistence_smoothsql_SmoothModel::OPTION_PERSISTENCE => 'default', \core_kernel_persistence_smoothsql_SmoothModel::OPTION_READABLE_MODELS => $this->getReadableModelIds(), \core_kernel_persistence_smoothsql_SmoothModel::OPTION_WRITEABLE_MODELS => array('1'), \core_kernel_persistence_smoothsql_SmoothModel::OPTION_NEW_TRIPLE_MODEL => '1')));
         $currentVersion = '2.7.4';
     }
     if ($currentVersion == '2.7.4' && defined('GENERIS_URI_PROVIDER')) {
         if (in_array(GENERIS_URI_PROVIDER, array('DatabaseSerialUriProvider', 'AdvKeyValueUriProvider'))) {
             $uriProviderClassName = '\\core_kernel_uri_' . GENERIS_URI_PROVIDER;
             $options = array(\core_kernel_uri_DatabaseSerialUriProvider::OPTION_PERSISTENCE => 'default', \core_kernel_uri_DatabaseSerialUriProvider::OPTION_NAMESPACE => LOCAL_NAMESPACE . '#');
             $provider = new $uriProviderClassName($options);
         } else {
             $uriProviderClassName = '\\common_uri_' . GENERIS_URI_PROVIDER;
             $provider = new $uriProviderClassName();
         }
         \core_kernel_uri_UriService::singleton()->setUriProvider($provider);
         $currentVersion = '2.7.5';
     }
     // service manager support
     if ($currentVersion == '2.7.5' || $currentVersion == '2.7.6' || $currentVersion == '2.7.7' || $currentVersion == '2.8.0') {
         $currentVersion = '2.9.0';
     }
     return $currentVersion;
 }
Ejemplo n.º 4
0
 /**
  * Short description of method getNewUri
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @return string
  */
 public static function getNewUri()
 {
     return core_kernel_uri_UriService::singleton()->generateUri();
 }