当前位置: 首页>>代码示例>>PHP>>正文


PHP eZSys::isShellExecution方法代码示例

本文整理汇总了PHP中eZSys::isShellExecution方法的典型用法代码示例。如果您正苦于以下问题:PHP eZSys::isShellExecution方法的具体用法?PHP eZSys::isShellExecution怎么用?PHP eZSys::isShellExecution使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在eZSys的用法示例。


在下文中一共展示了eZSys::isShellExecution方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gc

 public function gc($maxLifeTime)
 {
     if (eZSys::isShellExecution()) {
         return false;
     }
     ezpEvent::getInstance()->notify('session/gc', array($maxLifeTime));
     $db = eZDB::instance();
     eZSession::triggerCallback('gc_pre', array($db, $maxLifeTime));
     $sfHandler = $this->storage->getSaveHandler();
     if (method_exists($sfHandler, 'gc')) {
         $sfHandler->gc($maxLifeTime);
     }
     eZSession::triggerCallback('gc_post', array($db, $maxLifeTime));
     return false;
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:15,代码来源:ezpsessionhandlersymfony.php

示例2: isAllowedByCurrentIP

 private static function isAllowedByCurrentIP($allowedIpList)
 {
     $ipAddress = eZSys::clientIP();
     if ($ipAddress) {
         foreach ($allowedIpList as $itemToMatch) {
             if (preg_match("/^(([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+))(\\/([0-9]+)\$|\$)/", $itemToMatch, $matches)) {
                 if ($matches[6]) {
                     if (self::isIPInNet($ipAddress, $matches[1], $matches[7])) {
                         return true;
                     }
                 } else {
                     if ($matches[1] == $ipAddress) {
                         return true;
                     }
                 }
             }
         }
         return false;
     } else {
         return eZSys::isShellExecution() && in_array('commandline', $allowedIpList);
     }
 }
开发者ID:schwabokaner,项目名称:ezpublish-legacy,代码行数:22,代码来源:ezdebug.php

示例3: publishNode

 public static function publishNode($parentNodeID, $objectID, $versionNum, $mainNodeID)
 {
     $object = eZContentObject::fetch($objectID);
     $nodeAssignment = eZNodeAssignment::fetch($objectID, $versionNum, $parentNodeID);
     $version = $object->version($versionNum);
     $fromNodeID = $nodeAssignment->attribute('from_node_id');
     $originalObjectID = $nodeAssignment->attribute('contentobject_id');
     $nodeID = $nodeAssignment->attribute('parent_node');
     $opCode = $nodeAssignment->attribute('op_code');
     $parentNode = eZContentObjectTreeNode::fetch($nodeID);
     // if parent doesn't exist, return. See issue #18320
     if (!$parentNode instanceof eZContentObjectTreeNode) {
         eZDebug::writeError("Parent node doesn't exist. object id: {$objectID}, node_assignment id: " . $nodeAssignment->attribute('id'), __METHOD__);
         return;
     }
     $parentNodeID = $parentNode->attribute('node_id');
     $existingNode = null;
     $db = eZDB::instance();
     $db->begin();
     if (strlen($nodeAssignment->attribute('parent_remote_id')) > 0) {
         $existingNode = eZContentObjectTreeNode::fetchByRemoteID($nodeAssignment->attribute('parent_remote_id'));
     }
     if (!$existingNode) {
     }
     $existingNode = eZContentObjectTreeNode::findNode($nodeID, $object->attribute('id'), true);
     $updateSectionID = false;
     // now we check the op_code to see what to do
     if (($opCode & 1) == eZNodeAssignment::OP_CODE_NOP) {
         // There is nothing to do so just return
         $db->commit();
         if ($mainNodeID == false) {
             return $object->attribute('main_node_id');
         }
         return;
     }
     $updateFields = false;
     if ($opCode == eZNodeAssignment::OP_CODE_MOVE || $opCode == eZNodeAssignment::OP_CODE_CREATE) {
         //            if ( $fromNodeID == 0 || $fromNodeID == -1)
         if ($opCode == eZNodeAssignment::OP_CODE_CREATE || $opCode == eZNodeAssignment::OP_CODE_SET) {
             // If the node already exists it means we have a conflict (for 'CREATE').
             // We resolve this by leaving node-assignment data be.
             if ($existingNode == null) {
                 $parentNode = eZContentObjectTreeNode::fetch($nodeID);
                 $user = eZUser::currentUser();
                 if (!eZSys::isShellExecution() and !$user->isAnonymous()) {
                     eZContentBrowseRecent::createNew($user->id(), $parentNode->attribute('node_id'), $parentNode->attribute('name'));
                 }
                 $updateFields = true;
                 $existingNode = $parentNode->addChild($object->attribute('id'), true);
                 if ($fromNodeID == -1) {
                     $updateSectionID = true;
                 }
             } elseif ($opCode == eZNodeAssignment::OP_CODE_SET) {
                 $updateFields = true;
             }
         } elseif ($opCode == eZNodeAssignment::OP_CODE_MOVE) {
             if ($fromNodeID == 0 || $fromNodeID == -1) {
                 eZDebug::writeError("NodeAssignment '" . $nodeAssignment->attribute('id') . "' is marked with op_code='{$opCode}' but has no data in from_node_id. Cannot use it for moving node.", __METHOD__);
             } else {
                 // clear cache for old placement.
                 $additionalNodeIDList = array($fromNodeID);
                 eZContentCacheManager::clearContentCacheIfNeeded($objectID, $versionNum, $additionalNodeIDList);
                 $originalNode = eZContentObjectTreeNode::fetchNode($originalObjectID, $fromNodeID);
                 if ($originalNode->attribute('main_node_id') == $originalNode->attribute('node_id')) {
                     $updateSectionID = true;
                 }
                 $originalNode->move($parentNodeID);
                 $existingNode = eZContentObjectTreeNode::fetchNode($originalObjectID, $parentNodeID);
                 $updateFields = true;
             }
         }
     } elseif ($opCode == eZNodeAssignment::OP_CODE_REMOVE) {
         $db->commit();
         return;
     }
     if ($updateFields) {
         if (strlen($nodeAssignment->attribute('parent_remote_id')) > 0) {
             $existingNode->setAttribute('remote_id', $nodeAssignment->attribute('parent_remote_id'));
         }
         $existingNode->setAttribute('sort_field', $nodeAssignment->attribute('sort_field'));
         $existingNode->setAttribute('sort_order', $nodeAssignment->attribute('sort_order'));
     }
     $existingNode->setAttribute('contentobject_is_published', 1);
     eZDebug::createAccumulatorGroup('nice_urls_total', 'Nice urls');
     if ($mainNodeID > 0) {
         $existingNodeID = $existingNode->attribute('node_id');
         if ($existingNodeID != $mainNodeID) {
             eZContentBrowseRecent::updateNodeID($existingNodeID, $mainNodeID);
         }
         $existingNode->setAttribute('main_node_id', $mainNodeID);
     } else {
         $existingNode->setAttribute('main_node_id', $existingNode->attribute('node_id'));
     }
     $existingNode->store();
     if ($updateSectionID) {
         eZContentOperationCollection::updateSectionID($objectID, $versionNum);
     }
     $db->commit();
     if ($mainNodeID == false) {
         return $existingNode->attribute('node_id');
//.........这里部分代码省略.........
开发者ID:EVE-Corp-Center,项目名称:ECC-Website,代码行数:101,代码来源:ezcontentoperationcollection.php

示例4: execute

    public function execute( $process, $event )
    {
        $parameters = $process->attribute( 'parameter_list' );
        $object = eZContentObject::fetch( $parameters['object_id'] );
        $attribute = false;

        $dataMap = $object->attribute( 'data_map' );
        foreach ( $dataMap as $attr )
        {
            $dataType = $attr->attribute( 'data_type_string' );
            if ( $dataType == 'ezfeatureselect' )
            {
                $attribute = $attr;
                continue;
            }
        }

        // if object does not have a featureselect attribute.
        if ( $attribute == false )
        {
            return eZWorkflowType::STATUS_ACCEPTED;
        }

        // if we have not the first version published, we only need to enable/disable features
        if ( $object->attribute( 'modified' ) != $object->attribute( 'published' ) )
        {
            $attributeContent = $attribute->attribute( 'content' );
            $installedFeatureList = $attributeContent['installed_feature_list'];
            $availibleFeatureList = $attributeContent['availible_feature_list'];

            $mainNodeID = $object->attribute( 'main_node_id' );

            foreach( $availibleFeatureList as $feature => $featureName )
            {
                $featureObject = eZContentObject::fetchByRemoteID( $mainNodeID . '_' . $feature );
                if( !$featureObject )
                {
                    eZDebug::writeError( "Cannot find feature object", "eZXMLPublisherType::execute" );
                    continue;
                }
                $featureNode = $featureObject->attribute( 'main_node' );
                if( !$featureNode )
                {
                    eZDebug::writeError( "Cannot find feature node", "eZXMLPublisherType::execute" );
                    continue;
                }
                if ( in_array( $feature, $installedFeatureList ) )
                {
                    if ( $featureNode->attribute( 'is_hidden' ) )
                    {
                        eZContentObjectTreeNode::unhideSubTree( $featureNode );
                    }
                    $featureObject = $featureNode->attribute( 'object' );
                    $list          = $featureObject->reverseRelatedObjectList( false, 0, false,
                                                                               array( 'AllRelations' => eZContentObject::RELATION_ATTRIBUTE, 'IgnoreVisibility' => true )
                                                                             );
                    if ( is_array( $list ) )
                    {
                        foreach ( $list as $reverseRelatedContentObject )
                        {
                            $reverseRelatedMainNode = $reverseRelatedContentObject->attribute( 'main_node' );
                            eZContentObjectTreeNode::unhideSubTree( $reverseRelatedMainNode );
                        }
                    }
                }
                elseif ( !in_array( $feature, $installedFeatureList ) && !$featureNode->attribute( 'is_hidden' ) )
                {
                    if ( !$featureNode->attribute( 'is_hidden' ) )
                    {
                        eZContentObjectTreeNode::hideSubTree( $featureNode );
                    }
                    $featureObject = $featureNode->attribute( 'object' );
                    $list          = $featureObject->reverseRelatedObjectList( false, 0, false,
                                                                               array( 'AllRelations' => eZContentObject::RELATION_ATTRIBUTE, 'IgnoreVisibility' => true )
                                                                             );
                    if ( is_array( $list ) )
                    {
                        foreach ( $list as $reverseRelatedContentObject )
                        {
                            $reverseRelatedMainNode = $reverseRelatedContentObject->attribute( 'main_node' );
                            eZContentObjectTreeNode::hideSubTree( $reverseRelatedMainNode );
                        }
                    }
                }
            }
        }

        // defer to cron, this is safer because we might do a lot of things here
        include_once( 'lib/ezutils/classes/ezsys.php' );
        if ( eZSys::isShellExecution() == false )
        {
            return eZWorkflowType::STATUS_DEFERRED_TO_CRON_REPEAT;
        }

        // if we have the first version published, we need to set up the related things.
        if ( $object->attribute( 'modified' ) == $object->attribute( 'published' ) )
        {
            $classAttribute = $attribute->attribute( 'contentclass_attribute' );
            $templateName = $classAttribute->attribute( 'data_text1' );

//.........这里部分代码省略.........
开发者ID:sushilbshinde,项目名称:ezpublish-study,代码行数:101,代码来源:ezxmlpublishertype.php

示例5: measure

 /**
  * This method is called to allow this class to provide values for the perf
  * variables it caters to.
  * In this case, it actually gets called by self::filter().
  * To avoid unnecessary overhead, it cheats a little bit, and it does not provide
  * values for ALL variables it supports, but only for the ones it knows will
  * be logged.
  * @param string $output
  * @param $returnCode
  * @return array
  */
 public static function measure($output, $returnCode = null)
 {
     global $scriptStartTime;
     // This var we want to save as it is used for logs even when not present in TrackVariables.
     // Also using ga / piwik logs do alter $output, making length calculation in doLog() unreliable
     /// @todo this way of passing data around is not really beautiful...
     self::$outputSize = strlen($output);
     if ($returnCode !== null) {
         self::$returnCode = (int) $returnCode;
     } else {
         // for cli scripts, set default response status to 0 instead of 200
         if (eZSys::isShellExecution()) {
             self::$returnCode = 0;
         }
     }
     $out = array();
     $vars = eZPerfLoggerINI::variable('GeneralSettings', 'TrackVariables');
     foreach ($vars as $var) {
         switch ($var) {
             case 'output_size':
                 // some bugs persist forever...
             // some bugs persist forever...
             case 'ouput_size':
                 $out[$var] = self::$outputSize;
                 break;
             case 'execution_time':
                 // This global var does not exist anymore in eZP LS 5.0.
                 // We prefer using it when available as it is slightly more accurate
                 if ($scriptStartTime == 0) {
                     $debug = eZDebug::instance();
                     $scriptStartTime = $debug->ScriptStart;
                 }
                 $out[$var] = round(microtime(true) - $scriptStartTime, 3);
                 break;
             case 'mem_usage':
                 $out[$var] = round(memory_get_peak_usage(true), -3);
                 break;
             case 'db_queries':
                 // (nb: only works when debug is enabled.
                 // Also does most likely not work when logging is done directly from the eZ5 stack
                 /// @todo fix to run from eZ5 context
                 $dbini = eZINI::instance();
                 // we cannot use $db->databasename() because we get the same for mysql and mysqli
                 $type = preg_replace('/^ez/', '', $dbini->variable('DatabaseSettings', 'DatabaseImplementation'));
                 $type .= '_query';
                 // read accumulator
                 $debug = eZDebug::instance();
                 if (isset($debug->TimeAccumulatorList[$type])) {
                     $queries = $debug->TimeAccumulatorList[$type]['count'];
                 } else {
                     // NB: to tell difference between 0 db reqs per page and no debug we could look for ezdebug::isenabled,
                     // but what if it was enabled at some point and later disabled?...
                     $queries = "0";
                 }
                 $out[$var] = $queries;
                 break;
             case 'xhkprof_runs':
                 $out[$var] = implode(',', eZXHProfLogger::runs());
                 break;
             case 'user_id':
                 $out[$var] = eZUser::currentUser()->attribute('contentobject_id');
                 break;
             case 'unique_id':
                 $out[$var] = $_SERVER['UNIQUE_ID'];
                 break;
                 //case 'content/nodeid':
                 //    $out[$var] = self::$nodeId;
                 //    break;
             //case 'content/nodeid':
             //    $out[$var] = self::$nodeId;
             //    break;
             default:
                 // wildcard-based naming:
                 // content-info things, useful to help group/filter recorded data
                 if (strpos($var, 'content_info/') === 0 || strpos($var, 'module_result/') === 0) {
                     $out[$var] = self::getModuleResultData($var);
                     break;
                 }
                 // standard accumulators
                 /// @todo fix to run from eZ5 context
                 if (strpos($var, 'accumulators/') === 0) {
                     $parts = explode('/', $var, 3);
                     $type = $parts[1];
                     $debug = eZDebug::instance();
                     if (isset($debug->TimeAccumulatorList[$type])) {
                         if (@$parts[2] === 'count') {
                             $out[$var] = $debug->TimeAccumulatorList[$type]['count'];
                         } else {
                             $out[$var] = round($debug->TimeAccumulatorList[$type]['time'], 3);
//.........这里部分代码省略.........
开发者ID:gggeek,项目名称:ezperformancelogger,代码行数:101,代码来源:ezperflogger.php

示例6: reportError

 /**
  * This is called whenever an error occurs in one of the database handlers.
  *
  * If a transaction is active it will be invalidated as well.
  *
  * @access protected
  * @throws eZDBException
  */
 function reportError()
 {
     // If we have a running transaction we must mark as invalid
     // in which case a call to commit() will perform a rollback
     if ($this->TransactionCounter > 0) {
         $this->invalidateTransaction();
         // This is the unique ID for this incidence which will also be placed in the error logs.
         $transID = 'TRANSID-' . md5(time() . mt_rand());
         eZDebug::writeError('Transaction in progress failed due to DB error, transaction was rollbacked. Transaction ID is ' . $transID . '.', 'eZDBInterface::commit ' . $transID);
         $this->rollback();
         if ($this->errorHandling == eZDB::ERROR_HANDLING_EXCEPTIONS) {
             throw new eZDBException($this->ErrorMessage, $this->ErrorNumber);
         } else {
             // Stop execution immediately while allowing other systems (session etc.) to cleanup
             eZExecution::cleanup();
             eZExecution::setCleanExit();
             // Give some feedback, and also possibly show the debug output
             eZDebug::setHandleType(eZDebug::HANDLE_NONE);
             $ini = eZINI::instance();
             $adminEmail = $ini->variable('MailSettings', 'AdminEmail');
             if (!eZSys::isShellExecution()) {
                 if (!headers_sent()) {
                     header("HTTP/1.1 500 Internal Server Error");
                 }
                 $site = eZSys::serverVariable('HTTP_HOST');
                 $uri = eZSys::serverVariable('REQUEST_URI');
                 print "<div class=\"fatal-error\" style=\"";
                 print 'margin: 0.5em 0 1em 0; ' . 'padding: 0.25em 1em 0.75em 1em;' . 'border: 4px solid #000000;' . 'background-color: #f8f8f4;' . 'border-color: #f95038;" >';
                 print "<b>Fatal error</b>: A database transaction in eZ Publish failed.<br/>";
                 print "<p>";
                 print "The current execution was stopped to prevent further problems.<br/>\n" . "You should contact the <a href=\"mailto:{$adminEmail}?subject=Transaction failed on {$site} and URI {$uri} with ID {$transID}\">System Administrator</a> of this site with the information on this page.<br/>\n" . "The current transaction ID is <b>{$transID}</b> and has been logged.<br/>\n" . "Please include the transaction ID and the current URL when contacting the system administrator.<br/>\n";
                 print "</p>";
                 print "</div>";
                 $templateResult = null;
                 if (function_exists('eZDisplayResult')) {
                     eZDisplayResult($templateResult);
                 }
             } else {
                 fputs(STDERR, "Fatal error: A database transaction in eZ Publish failed.\n");
                 fputs(STDERR, "\n");
                 fputs(STDERR, "The current execution was stopped to prevent further problems.\n" . "You should contact the System Administrator ({$adminEmail}) of this site.\n" . "The current transaction ID is {$transID} and has been logged.\n" . "Please include the transaction ID and the name of the current script when contacting the system administrator.\n");
                 fputs(STDERR, "\n");
                 fputs(STDERR, eZDebug::printReport(false, false, true));
             }
             // PHP execution stops here
             exit(1);
         }
     }
 }
开发者ID:netbliss,项目名称:ezpublish,代码行数:57,代码来源:ezdbinterface.php

示例7: isAllowedByCurrentIP

 /**
  * If debugging is allowed for the current IP address.
  *
  * @param array $allowedIpList
  * @return bool
  */
 private static function isAllowedByCurrentIP($allowedIpList)
 {
     $ipAddresIPV4Pattern = "/^(([0-9]+)\\.([0-9]+)\\.([0-9]+)\\.([0-9]+))(\\/([0-9]+)\$|\$)/";
     $ipAddressIPV6Pattern = "/^((([0-9A-Fa-f]{1,4}:){7}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}:[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){5}:([0-9A-Fa-f]{1,4}:)?[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){4}:([0-9A-Fa-f]{1,4}:){0,2}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){3}:([0-9A-Fa-f]{1,4}:){0,3}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){2}:([0-9A-Fa-f]{1,4}:){0,4}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){6}((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|(([0-9A-Fa-f]{1,4}:){0,5}:((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|(::([0-9A-Fa-f]{1,4}:){0,5}((\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b)\\.){3}(\\b((25[0-5])|(1\\d{2})|(2[0-4]\\d)|(\\d{1,2}))\\b))|([0-9A-Fa-f]{1,4}::([0-9A-Fa-f]{1,4}:){0,5}[0-9A-Fa-f]{1,4})|(::([0-9A-Fa-f]{1,4}:){0,6}[0-9A-Fa-f]{1,4})|(([0-9A-Fa-f]{1,4}:){1,7}:))(\\/([0-9]+)\$|\$)\$/";
     $ipAddress = eZSys::clientIP();
     if ($ipAddress) {
         foreach ($allowedIpList as $itemToMatch) {
             // Test for IPv6 Addresses first instead of IPv4 addresses as IPv6
             // addresses can contain dot separators within them
             if (preg_match("/:/", $ipAddress)) {
                 if (preg_match($ipAddressIPV6Pattern, $itemToMatch, $matches)) {
                     if ($matches[69]) {
                         if (self::isIPInNetIPv6($ipAddress, $itemToMatch)) {
                             return true;
                         }
                     } else {
                         if ($matches[1] == $itemToMatch) {
                             return true;
                         }
                     }
                 }
             } elseif (preg_match("/\\./", $ipAddress)) {
                 if (preg_match($ipAddresIPV4Pattern, $itemToMatch, $matches)) {
                     if ($matches[6]) {
                         if (self::isIPInNet($ipAddress, $matches[1], $matches[7])) {
                             return true;
                         }
                     } else {
                         if ($matches[1] == $ipAddress) {
                             return true;
                         }
                     }
                 }
             }
         }
         return false;
     } else {
         return eZSys::isShellExecution() && in_array('commandline', $allowedIpList);
     }
 }
开发者ID:mugoweb,项目名称:ezpublish-legacy,代码行数:46,代码来源:ezdebug.php


注:本文中的eZSys::isShellExecution方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。