Ejemplo n.º 1
0
 /**
  * Return the active lock system.
  *
  * @param boolean $canInit (optional) if false and lockSystem isn't yet initialized, return null
  * @return array GalleryStatus a status code
  *               GalleryLockSystem the lock implementation (reference)
  */
 function &getLockSystem($canInit = true)
 {
     if (!isset($this->_lockSystem)) {
         if ($canInit) {
             list($ret, $which) = MyOOS_CoreApi::getPluginParameter('module', 'core', 'lock.system');
             if ($ret) {
                 $ret = array($ret, null);
                 return $ret;
             }
         } else {
             $which = 'null';
         }
         switch ($which) {
             case 'flock':
                 MyOOS_CoreApi::requireOnce('modules/core/classes/FlockLockSystem.class');
                 $this->_lockSystem = new FlockLockSystem();
                 break;
             case 'database':
                 MyOOS_CoreApi::requireOnce('modules/core/classes/DatabaseLockSystem.class');
                 $this->_lockSystem = new DatabaseLockSystem();
                 break;
             case 'null':
                 $this->_lockSystem = null;
                 break;
             default:
                 $ret = array(MyOOS_CoreApi::error(ERROR_BAD_PARAMETER), null);
                 return $ret;
         }
     }
     $ret = array(null, &$this->_lockSystem);
     return $ret;
 }
Ejemplo n.º 2
0
 /**
  * Remove entries from a map
  *
  * @param string $mapName the map we're working on
  * @param array $data an associative array of data about the entries to match
  * @return GalleryStatus a status code
  */
 function removeMapEntry($mapName, $data)
 {
     global $gallery;
     if (sizeof($data) == 0) {
         return MyOOS_CoreApi::error(ERROR_BAD_PARAMETER);
     }
     $storage =& $gallery->getStorage();
     $ret = $storage->removeMapEntry($mapName, $data);
     if ($ret) {
         return $ret;
     }
     return null;
 }