Esempio n. 1
0
File: index.php Progetto: truffo/eep
 public function run($argv, $additional)
 {
     $command = @$argv[2];
     $param1 = @$argv[3];
     $param2 = @$argv[4];
     if (!in_array($command, $this->availableCommands)) {
         throw new Exception("Command '" . $command . "' not recognized.");
     }
     $eepCache = eepCache::getInstance();
     switch ($command) {
         case "help":
             echo "'use' available keys: " . implode(", ", $this->availableCommands) . "\n";
             echo "\n" . $this->help . "\n";
             break;
         case self::use_dump:
             $this->dumpCache();
             break;
         case eepCache::use_key_contentclass:
             $contentClass = eZContentClass::fetchByIdentifier($param1);
             if (!$contentClass) {
                 throw new Exception("This content class does not exist: [" . $param1 . "]");
             }
             // note that a value == "" means to clear the setting
             $eepCache->writetoCache(eepCache::use_key_contentclass, $param1);
             break;
         case eepCache::use_key_contentnode:
             if (!eepValidate::validateContentNodeId($param1)) {
                 throw new Exception("This is not an node id: [" . $param1 . "]");
             }
             $eepCache->writetoCache(eepCache::use_key_contentnode, $param1);
             break;
         case eepCache::use_key_object:
             if (!eepValidate::validateContentObjectId($param1)) {
                 throw new Exception("This is not an object id: [" . $param1 . "]");
             }
             $eepCache->writetoCache(eepCache::use_key_object, $param1);
             break;
         case eepCache::use_key_attribute:
             // todo, verify that this is indeed a content class attribute
             $eepCache->writetoCache(eepCache::use_key_attribute, $param1);
             break;
         case eepCache::use_key_siteaccess:
             // todo, verify that this is indeed a site access
             $eepCache->writetoCache(eepCache::use_key_siteaccess, $param1);
             break;
         case eepCache::use_key_ezroot:
             if ("/" == substr($param1, 0, 1)) {
                 // absolute path
                 $eZPublishRootPath = $param1;
             } else {
                 // relative path
                 $eZPublishRootPath = getcwd() . "/" . $param1;
             }
             $eepCache->writetoCache(eepCache::use_key_ezroot, realpath($eZPublishRootPath));
             // if you require this now, you might clash with an existing
             // autoload, so just save the new path in the cache, and the
             // next run will load the new autoload
             //require $eZPublishRootPath.'/autoload.php';
             break;
     }
 }
Esempio n. 2
0
File: index.php Progetto: truffo/eep
 public function run($argv, $additional)
 {
     $command = @$argv[2];
     $param1 = @$argv[3];
     $param2 = @$argv[4];
     if (!in_array($command, $this->availableCommands)) {
         throw new Exception("Command '" . $command . "' not recognized.");
     }
     $eepCache = eepCache::getInstance();
     switch ($command) {
         case "help":
             echo "\nAvailable commands:: " . implode(", ", $this->availableCommands) . "\n";
             echo "\n" . $this->help . "\n";
             break;
         case self::contentobject_info:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             $this->fetchContentObjectFromId($objectId);
             break;
         case self::contentobject_datamap:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             $this->fetchDataMapFromId($objectId);
             break;
         case self::contentobject_related:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             $this->fetchRelated($objectId, false, $additional);
             break;
         case self::contentobject_reverserelated:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             $this->fetchReverseRelated($objectId, $additional);
             break;
         case self::contentobject_delete:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             $this->delete($objectId);
             break;
         case self::contentobject_contentnode:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             echo $this->convertToNodeId($objectId) . "\n";
             break;
         case self::contentobject_republish:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             eep::republishObject($objectId);
             echo "republished " . $objectId . "\n";
             break;
         case self::contentobject_clearcache:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             $this->clearObjectCache($objectId);
             break;
         case self::contentobject_sitemapxml:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             $this->sitemapxml($objectId, $param2, $param3, $param4);
             // objid, domain, change-frequency, priority
             break;
         case self::contentobject_deleteversions:
             $objectId = $eepCache->readFromCache(eepCache::use_key_object);
             if ($param1) {
                 $objectId = $param1;
             }
             if (!eepValidate::validateContentObjectId($objectId)) {
                 throw new Exception("This is not an object id: [" . $objectId . "]");
             }
             $this->deleteversions($objectId);
             break;
         case self::contentobject_fetchbyremoteid:
             $this->fetchbyremoteid($param1);
             break;
     }
 }
Esempio n. 3
0
File: index.php Progetto: truffo/eep
 private function location($objectId, $parentNodeId)
 {
     if (!eepValidate::validateContentObjectId($objectId)) {
         throw new Exception("This is not an object id: [" . $objectId . "]");
     }
     if (!eepValidate::validateContentNodeId($parentNodeId)) {
         throw new Exception("This is not a node id: [" . $parentNodeId . "]");
     }
     $object = eZContentObject::fetch($objectId);
     $object->addLocation($parentNodeId);
     // this is a guess; but otherwise, the new node doesn't become available
     eep::republishObject($objectId);
 }