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


PHP file::log方法代码示例

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


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

示例1: importSeries

 /**
  * Imports Series from Opus3 to Opus4 in alphabetical order
  *
  * @param DOMDocument $data XML-Document to be imported
  * @return void
  */
 protected function importSeries($data)
 {
     $mf = $this->config->migration->mapping->series;
     $fp = null;
     $fp = @fopen($mf, 'w');
     if (!$fp) {
         $this->logger->log("Could not create '" . $mf . "' for Series", Zend_Log::ERR);
         return;
     }
     $series = $this->transferOpusSeries($data);
     $sort_order = 1;
     foreach ($series as $s) {
         if (array_key_exists('name', $s) === false) {
             continue;
         }
         if (array_key_exists('sr_id', $s) === false) {
             continue;
         }
         $sr = new Opus_Series();
         $sr->setTitle($s['name']);
         $sr->setVisible(1);
         $sr->setSortOrder($sort_order++);
         $sr->store();
         $this->logger->log("Series imported: " . $s['name'], Zend_Log::DEBUG);
         fputs($fp, $s['sr_id'] . ' ' . $sr->getId() . "\n");
     }
     fclose($fp);
 }
开发者ID:alexukua,项目名称:opus4,代码行数:34,代码来源:Opus3SeriesImport.php

示例2: checkMandatoryFields

 protected function checkMandatoryFields($lic, $name)
 {
     if (is_null($lic->getActive())) {
         $this->logger->log("No Attribute 'active' for " . $name, Zend_Log::ERR);
         if (!is_null($this->config->migration->licence->active)) {
             $lic->setActive($this->config->migration->licence->active);
             $this->logger->log("Set Attribute 'active' to default value '" . $lic->getActive() . "' for " . $name, Zend_Log::ERR);
         }
     }
     if (is_null($lic->getLanguage())) {
         $this->logger->log("No Attribute 'language' for " . $name, Zend_Log::ERR);
         if (!is_null($this->config->migration->licence->language)) {
             $lic->setLanguage($this->config->migration->licence->language);
             $this->logger->log("Set Attribute 'language' to default value '" . $lic->getLanguage() . "' for " . $name, Zend_Log::ERR);
         }
     }
     if (is_null($lic->getLinkLicence())) {
         $this->logger->log("No Attribute 'link_licence' for " . $name, Zend_Log::ERR);
         if (!is_null($this->config->migration->licence->link_licence)) {
             $lic->setLinkLicence($this->config->migration->licence->link_licence);
             $this->logger->log("Set Attribute 'link_licence' to default value '" . $lic->getLinkLicence() . "' for " . $name, Zend_Log::ERR);
         }
     }
     if (is_null($lic->getMimeType())) {
         $this->logger->log("No Attribute 'mime_type' for " . $name, Zend_Log::ERR);
         if (!is_null($this->config->migration->licence->mime_type)) {
             $lic->setMimeType($this->config->migration->licence->mime_type);
             $this->logger->log("Set Attribute 'mime_type' to default value '" . $lic->getMimeType() . "' for " . $name, Zend_Log::ERR);
         }
     }
     if (is_null($lic->getNameLong())) {
         $this->logger->log("No Attribute 'name_long' for " . $name, Zend_Log::ERR);
         if (!is_null($this->config->migration->licence->name_long)) {
             $lic->setNameLong($this->config->migration->licence->name_long);
             $this->logger->log("Set Attribute 'name_long' to default value '" . $lic->getNameLong() . "' for " . $name, Zend_Log::ERR);
         }
     }
     if (is_null($lic->getPodAllowed())) {
         $this->logger->log("No Attribute 'pod_allowed' for " . $name, Zend_Log::ERR);
         if (!is_null($this->config->migration->licence->pod_allowed)) {
             $lic->setPodAllowed($this->config->migration->licence->pod_allowed);
             $this->logger->log("Set Attribute 'pod_allowed' to default value '" . $lic->getPodAllowed() . "' for " . $name, Zend_Log::ERR);
         }
     }
 }
开发者ID:alexukua,项目名称:opus4,代码行数:45,代码来源:Opus3LicenceImport.php

示例3: isValidFile

 /** Checks if File is valid to import.
  *
  * @param string
  * @return boolean
  */
 private function isValidFile($f)
 {
     // Exclude 'index.html' and files starting with '.'
     if (basename($f) == 'index.html' || strpos(basename($f), '.') === 0) {
         $this->logger->log("Skipped File '" . basename($f) . "' of OPUS3-Id '" . $this->opus3Id . "'", Zend_Log::DEBUG);
         return false;
     }
     // ERROR: File with same Basnemae already imported
     if (array_search(basename($f), $this->filesImported) !== false) {
         $this->logger->log("File '" . basename(dirname($f)) . "/" . basename($f) . "' already imported for Opus3-Id '" . $this->opus3Id . "'", Zend_Log::ERR);
         return false;
     }
     // ERROR: Filename has no Extension
     if (strrchr($f, ".") === false) {
         $this->logger->log("File '" . basename($f) . "' of OPUS3-Id '" . $this->opus3Id . "' has no extension and will be ignored", Zend_Log::ERR);
         return false;
     }
     return true;
 }
开发者ID:alexukua,项目名称:opus4,代码行数:24,代码来源:Opus3FileImport.php

示例4: getMapping

 /**
  * Get mapped Values for a document and add it
  *
  * @mappingFile: name of the Mapping-File
  * @id: original id
  * @return new id
  */
 private function getMapping($mappingFile, $id)
 {
     /* TODO: CHECK if File exists , echo ERROR and return null if not*/
     if (!is_readable($mappingFile)) {
         $this->logger->log("MappingFile '" . $mappingFile . "' is not readable", Zend_Log::ERR);
         return null;
     }
     $fp = file($mappingFile);
     $mapping = array();
     foreach ($fp as $line) {
         $values = explode(" ", $line);
         $mapping[$values[0]] = trim($values[1]);
     }
     if (array_key_exists($id, $mapping) === false) {
         unset($fp);
         return null;
     }
     unset($fp);
     return $mapping[$id];
 }
开发者ID:alexukua,项目名称:opus4,代码行数:27,代码来源:Opus3XMLImport.php

示例5: importInstitutes

 /**
  * Imports Institutes from Opus3 to Opus4 directly (without XML)
  *
  * @param DOMDocument $data XML-Document to be imported
  * @return array List of documents that have been imported
  */
 protected function importInstitutes($data, $pColls)
 {
     $mf = $this->_config->migration->mapping->institutes;
     $fp = null;
     try {
         $fp = @fopen($mf, 'w');
         if (!$fp) {
             throw new Exception("ERROR Opus3InstituteImport: Could not create '" . $mf . "' for Institutes.\n");
         }
     } catch (Exception $e) {
         $this->_logger->log($e->getMessage(), Zend_Log::ERR);
         return;
     }
     $classification = $this->transferOpusClassification($data);
     foreach ($classification as $class) {
         if (array_key_exists('fakultaet', $class) === false || array_key_exists('name', $class) === false || array_key_exists('nr', $class) === false) {
             $invalidInstitute = '';
             foreach ($class as $key => $val) {
                 $invalidInstitute .= "[{$key}:'{$val}'] ";
             }
             $this->_logger->log("Invalid entry for Institute will be ignored: '" . $invalidInstitute, Zend_Log::ERR);
             continue;
         }
         if (array_key_exists($class['fakultaet'], $pColls) === false) {
             $this->_logger->log("No Faculty with ID '" . $class['fakultaet'] . "' for Institute with ID '" . $class['nr'] . "'", Zend_Log::ERR);
             continue;
         }
         /*  Create a Collection for Institute */
         $root = new Opus_Collection($pColls[$class['fakultaet']]);
         $coll = $root->addLastChild();
         $coll->setName($class['name']);
         $coll->setVisible(1);
         $root->store();
         $this->_logger->log("Institute imported: " . $class['name'], Zend_Log::DEBUG);
         fputs($fp, $class['nr'] . ' ' . $coll->getId() . "\n");
     }
     fclose($fp);
 }
开发者ID:hauschke,项目名称:migration,代码行数:44,代码来源:Opus3InstituteImport.php

示例6: importCollectionsDirectly

 /**
  * Imports Collections from Opus3 to Opus4 directly (from DB-table to DB-tables)
  *
  * @param DOMDocument $data XML-Document to be imported
  * @return array List of documents that have been imported
  */
 protected function importCollectionsDirectly($data, $collRole)
 {
     $mf = $this->_config->migration->mapping->collections;
     $fp = null;
     try {
         $fp = @fopen($mf, 'w');
         if (!$fp) {
             throw new Exception("Could not create '" . $mf . "' for Collections");
         }
     } catch (Exception $e) {
         $this->_logger->log($e->getMessage(), Zend_Log::ERR);
         return;
     }
     try {
         $collections = $this->transferOpusClassification($data);
         if (count($collections) == 0) {
             throw new Exception("No Collections in XML-Dump");
         }
         // sort by lft-values
         $sortedCollections = $this->msort($collections, 'lft');
         if (count($sortedCollections) == 0) {
             // TODO: Improve error handling in case of empty collections.
             throw new Exception("Sorted collections empty");
         }
         if ($sortedCollections[0]['lft'] != 1) {
             // var_dump($sorted_collections[0]);
             // TODO: Improve error handling in case of wrong left-ids.
             throw new Exception("First left_id is not 1");
         }
         // 1 is used as a predefined key and should not be used again!
         // so lets increment all old IDs by 1
         $previousRightStack = array();
         $previousNodeStack = array();
         $newCollection = null;
         foreach ($sortedCollections as $row) {
             //echo ".";
             // case root_node
             if (count($previousRightStack) == 0) {
                 //echo "case 1: id -" . $row['coll_id'] . "-left -" . $row['lft'] . "- right -" .$row['rgt']. "\n";
                 $root = $collRole->getRootCollection();
                 $newCollection = $root->addLastChild();
                 //              $collRole->store();
                 array_push($previousNodeStack, $newCollection);
                 array_push($previousRightStack, $row['rgt']);
             } else {
                 // Throw elements from stack as long we don't have a
                 // father *or* a brother.
                 do {
                     $previousNode = array_pop($previousNodeStack);
                     $previousRight = array_pop($previousRightStack);
                     $isChild = $row['rgt'] < $previousRight;
                     $isBrother = (int) $row['lft'] === (int) $previousRight + 1;
                 } while (!$isChild && !$isBrother);
                 // same level
                 if ($isBrother) {
                     //echo "case 2: id -" . $row['coll_id'] . "-left -" . $row['lft'] . "- right -" . $row['rgt']
                     //    . "- prevright - " . $previousRight . "-\n";
                     // its a brother of previous node
                     $leftBrother = $previousNode;
                     $newCollection = $leftBrother->addNextSibling();
                     $leftBrother->store();
                     array_push($previousNodeStack, $newCollection);
                     array_push($previousRightStack, $row['rgt']);
                 } else {
                     if ($isChild) {
                         // go down one level
                         //echo "case 3: id -" . $row['coll_id'] . "-left -" . $row['lft'] . "- right -" . $row['rgt']
                         // . "- prevright - " . $previousRight . "-\n";
                         // its a child of previous node
                         $father = $previousNode;
                         $newCollection = $father->addLastChild();
                         $father->store();
                         array_push($previousNodeStack, $father);
                         array_push($previousRightStack, $previousRight);
                         array_push($previousNodeStack, $newCollection);
                         array_push($previousRightStack, $row['rgt']);
                     } else {
                         //echo "case 4: id -" . $row['coll_id'] . "-left -" . $row['lft'] . "- right -" . $row['rgt']
                         // . "- prevright - " . $previousRight . "-\n";
                         throw new Exception("Collectionstructure of id " . $row['coll_id'] . " not valid");
                     }
                 }
             }
             $newCollection->setVisible(1);
             $newCollection->setName($row['coll_name']);
             $newCollection->store();
             $previousRight = $row['rgt'];
             $this->_logger->log("Collection imported: " . $row['coll_name'], Zend_Log::DEBUG);
             fputs($fp, $row['coll_id'] . ' ' . $newCollection->getId() . "\n");
         }
     } catch (Exception $e) {
         $this->_logger->log($e->getMessage(), Zend_Log::ERR);
     }
     fclose($fp);
//.........这里部分代码省略.........
开发者ID:hauschke,项目名称:migration,代码行数:101,代码来源:Opus3CollectionsImport.php


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