예제 #1
0
파일: index.php 프로젝트: truffo/eep
 private function dumpCache()
 {
     $eepCache = eepCache::getInstance();
     $all = $eepCache->getAll();
     $results[] = array("key", "value");
     foreach ($all as $key => $value) {
         $results[] = array($key, $value);
     }
     // do output
     eep::printTable($results, "eep cache");
 }
예제 #2
0
파일: index.php 프로젝트: truffo/eep
 private function section_list()
 {
     $sectionObjects = eZSection::fetchList();
     $results = array();
     $results[] = array("Id", "NavigationPartIdentifier", "Count", "Name");
     foreach ($sectionObjects as $section) {
         $count = eZSectionFunctionCollection::fetchObjectListCount($section->ID);
         $count = $count["result"];
         $results[] = array($section->ID, $section->NavigationPartIdentifier, $count, $section->Name);
     }
     eep::printTable($results, "all sections");
 }
예제 #3
0
파일: index.php 프로젝트: truffo/eep
 public function run($argv, $additional)
 {
     $command = @$argv[2];
     $param1 = @$argv[3];
     $param2 = @$argv[4];
     global $eepPath;
     $eepCache = eepCache::getInstance();
     $availableModules = $eepCache->readFromCache(eepCache::misc_key_availablemodules);
     if (!in_array($command, $availableModules)) {
         throw new Exception("Command '" . $command . "' not recognized.");
     }
     switch ($command) {
         case "help":
             sort($availableModules);
             echo "\nAvailable modules: " . implode($availableModules, ", ") . "\n";
             echo "\nModules path: " . $eepPath . "/modules/\n";
             echo "\n" . $this->help . "\n";
             $aliases = eep::getListOfAliases();
             $table = array();
             $table[] = array("Alias", "Command or Module");
             foreach ($aliases as $alias => $full) {
                 $table[] = array($alias, $full);
             }
             eep::printTable($table, "Available shortcuts");
             break;
         default:
             // this is an infamous hack; redirect the request to a different
             // module, and the help function there
             global $argv;
             global $argc;
             $argv[1] = $command;
             // the module, not actually used
             $argv[2] = "help";
             // the command, which is help
             global $eepPath;
             require_once $eepPath . "/modules/" . $command . "/index.php";
             break;
     }
 }
예제 #4
0
파일: index.php 프로젝트: truffo/eep
 private function fetchRelated($objectId, $reverse, $additional)
 {
     $object = eZContentObject::fetch($objectId);
     // some other parameters:
     // LoadDataMap
     // Limit
     // Offset
     // AsObject
     // SortBy
     // IgnoreVisibility
     $parameters = array();
     $parameters["AllRelations"] = true;
     $parameters["IgnoreVisibility"] = true;
     if (isset($additional["limit"])) {
         $parameters["Limit"] = $additional["limit"];
     }
     if (isset($additional["offset"])) {
         $parameters["Offset"] = $additional["offset"];
     }
     $reverseRelated = $object->relatedObjects(false, false, 0, false, $parameters, $reverse);
     $keepers = array("ObjectID", "MainNodeID", "ClassIdentifier", "SID", "Name");
     $results[] = $keepers;
     $rowCount = 0;
     foreach ($reverseRelated as $revObject) {
         $row = array($revObject->ID, $revObject->mainNodeId(), $revObject->ClassIdentifier, $revObject->SectionID, $revObject->Name);
         $results[] = $row;
         $rowCount++;
     }
     $methodPrefix = "Reverse related";
     if (!$reverse) {
         $methodPrefix = "Related";
     }
     eep::printTable($results, $methodPrefix . " objects [" . $objectId . "](count " . $rowCount . ")");
 }
예제 #5
0
파일: index.php 프로젝트: truffo/eep
 private function fetchall()
 {
     $limit = false;
     $results = array();
     $results[] = array("ID", "Name");
     if (isset($additional["limit"])) {
         $limit = $additional["limit"];
     }
     $offset = false;
     if (isset($additional["offset"])) {
         $offset = $additional["offset"];
     }
     $allInstances = eZContentClassGroup::fetchList(false, false);
     $title = "Viewing all groups";
     foreach ($allInstances as $group) {
         $results[] = array($group["id"], $group["name"]);
     }
     eep::printTable($results, $title);
 }
예제 #6
0
파일: eepHelpers.php 프로젝트: truffo/eep
 static function displayObjectList($list, $title)
 {
     $results = array();
     $results[] = array("Id", "NId", "SId", "V", "Remote Id", "Class Id", "Name");
     foreach ($list as $n => $object) {
         $results[] = array($object->ID, $object->mainNodeID(), $object->SectionID, $object->CurrentVersion, $object->RemoteID, $object->contentClassIdentifier(), strlen($object->Name) > 60 ? substr($object->Name, 0, 57) . "..." : $object->Name);
         //unset($object);
         //unset( $list[$n] );
         //unset( $GLOBALS[ 'eZContentObjectContentObjectCache' ] );
         //unset( $GLOBALS[ 'eZContentObjectDataMapCache' ] );
         //unset( $GLOBALS[ 'eZContentObjectVersionCache' ] );
     }
     eep::printTable($results, $title);
 }
예제 #7
0
파일: index.php 프로젝트: truffo/eep
 private function fields($objectId)
 {
     $parameters = array();
     $parameters['q'] = 'meta_id_si:' . $objectId;
     $query = array('baseURL' => false, 'request' => '/select', 'parameters' => $parameters);
     $search = eZFunctionHandler::execute('ezfind', 'rawSolrRequest', $query);
     if ($search['response']['numFound'] > 0) {
         $results = array();
         $header = array('Field', 'Has data', 'Multi valued');
         $results[] = $header;
         foreach ($search['response']['docs'][0] as $index => $doc) {
             $hasData = 'no';
             $multiValued = 'no';
             if (is_array($doc) && count($doc)) {
                 $hasData = 'yes';
                 $multiValued = 'yes';
             } elseif ($doc !== '') {
                 $hasData = 'yes';
             }
             $results[] = array($index, $hasData, $multiValued);
         }
         eep::printTable($results, "List ezfind fields [{$objectId}]");
     } else {
         echo "No results\n";
     }
 }
예제 #8
0
파일: index.php 프로젝트: truffo/eep
 private function listExtensions()
 {
     $definedByFolder = array();
     $siteINI = eZINI::instance("site.ini");
     $extensionPath = "./" . $siteINI->variable("ExtensionSettings", "ExtensionDirectory");
     $hDir = opendir($extensionPath);
     $file = readdir($hDir);
     while (false != $file) {
         if (!in_array($file, array(".", "..", ".svn"))) {
             if (is_dir($extensionPath . "/" . $file)) {
                 $definedByFolder[] = $file;
             }
         }
         $file = readdir($hDir);
     }
     $activeExtensions = $siteINI->variable("ExtensionSettings", "ActiveExtensions");
     $activeAccessExtensions = $siteINI->variable("ExtensionSettings", "ActiveAccessExtensions");
     $designINI = eZINI::instance("design.ini");
     $designExtensions = $designINI->variable("ExtensionSettings", "DesignExtensions");
     $moduleINI = eZINI::instance("module.ini");
     $moduleExtensions = $moduleINI->variable("ModuleSettings", "ExtensionRepositories");
     $results[] = array("folders", "ActiveExtensions", "A.A.Extensions", "design", "modules");
     // todo, there are more things that you could list here ... autoloads, cronjobs, workflow events ...
     // another thing that an extension might do is declare a siteaccess
     foreach ($definedByFolder as $folder) {
         $results[] = array($folder, in_array($folder, $activeExtensions) ? $folder : "", in_array($folder, $activeAccessExtensions) ? $folder : "", in_array($folder, $designExtensions) ? $folder : "", in_array($folder, $moduleExtensions) ? $folder : "");
     }
     eep::printTable($results, "list extensions");
 }
예제 #9
0
 public static function info($classIdentifier, $attributeIdentifier, $fieldIdentifier)
 {
     $contentClass = eZContentClass::fetchByIdentifier($classIdentifier);
     if (!$contentClass) {
         throw new Exception("Failed to instantiate content class [" . $classIdentifier . "]");
     }
     $classDataMap = $contentClass->attribute("data_map");
     if (!isset($classDataMap[$attributeIdentifier])) {
         throw new Exception("Content class '" . $classIdentifier . "' does not contain this attribute: [" . $attributeIdentifier . "]");
     }
     $fieldList = $classDataMap[$attributeIdentifier]->attributes();
     $results[] = array("Field Name", "Field Value", "Value Type");
     foreach ($fieldList as $fieldName) {
         $value = $classDataMap[$attributeIdentifier]->attribute($fieldName);
         $type = "string";
         if (is_array($value)) {
             $value = serialize($value);
             $type = "Array";
         }
         $results[] = array($fieldName, $value, $type);
     }
     eep::printTable($results, "Class attribute fields");
 }
예제 #10
0
파일: index.php 프로젝트: truffo/eep
 private function ezflow_list_blocktypes($output)
 {
     $validOutput = array('simple', 'grouped');
     if (!in_array($output, $validOutput)) {
         $output = 'simple';
     }
     $db = eZDB::instance();
     $sql['simple'] = "SELECT block_type, id as block_id FROM `ezm_block` ORDER BY `block_type` ASC";
     $sql['grouped'] = "\n            SELECT \n                block_type, \n                COUNT(block_type) as count, \n                (SELECT \n                    GROUP_CONCAT(id) \n                FROM \n                    `ezm_block` t2 \n                WHERE \n                    t1.block_type = t2.block_type\n                ) as block_ids \n            FROM \n                `ezm_block` t1 \n            GROUP BY t1.block_type \n            ORDER BY t1.`block_type` ASC;";
     // header field names for each output mode
     $headers['simple'] = array("block_type", "block_id");
     $headers['grouped'] = array("block_type", "count", "block_ids");
     if ($query = $db->query($sql[$output])) {
         // add field headers row
         $results[] = $headers[$output];
         while ($row = $query->fetch_array(MYSQL_NUM)) {
             $result = array();
             foreach ($row as $index => $value) {
                 $result[] = $value;
             }
             $results[] = $result;
         }
         eep::printTable($results, "ezflow list blocktypes [{$output}]");
     }
 }
예제 #11
0
파일: index.php 프로젝트: truffo/eep
 private function fetchNodeInfoFromId($nodeId)
 {
     if (!eepValidate::validateContentNodeId($nodeId)) {
         throw new Exception("This is not a node id: [" . $nodeId . "]");
     }
     $keepers = array("Name", "ContentObjectID", "MainNodeID", "ClassIdentifier", "PathIdentificationString", "PathString", "ParentNodeID", "CurrentLanguage", "ContentObjectVersion", "RemoteID", "IsHidden", "IsInvisible", "ContentObjectIsPublished");
     // get the node
     $node = eZContentObjectTreeNode::fetch($nodeId);
     //var_dump($node);
     // extract the members we want
     $results[] = array("key", "value");
     foreach ($keepers as $key) {
         $results[] = array($key, $node->{$key});
     }
     // additional info
     $results[] = array("Reverse related count", eZContentObjectTreeNode::reverseRelatedCount(array($nodeId)));
     $params = array('Depth' => 1, 'DepthOperator' => 'eq', 'Limitation' => array());
     $results[] = array("Children count", eZContentObjectTreeNode::subTreeCountByNodeID($params, $nodeId));
     $results[] = array("URL Alias", $node->urlAlias());
     // do output
     eep::printTable($results, "contentnode info [" . $nodeId . "]");
 }