コード例 #1
0
ファイル: Collection.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * Check if everything checks out and the collection is ready to go
  *
  * @param  void
  * @return bool		true on success, throws exception on failure
  */
 public function verify()
 {
     require_once dirname(__DIR__) . DS . 'helpers' . DS . 'Integrity.php';
     $integrityCheck = \Integrity::collectionIntegrityCheck($this);
     if ($integrityCheck->status != 'ok') {
         $errorMessage = "Integrity check error:";
         foreach ($integrityCheck->errors as $error) {
             $errorMessage .= '<br>' . $error;
         }
         throw new \Exception($errorMessage);
     }
     if (empty($this->data->name)) {
         throw new \Exception(Lang::txt('No collection name set'));
     }
     if (empty($this->data->type)) {
         throw new \Exception(Lang::txt('No collection type set'));
     }
     return true;
 }
コード例 #2
0
 private function checkIntegrity($collection)
 {
     // If the collection is not being published, no need to check for integrity
     if (!$collection->getActiveStatus()) {
         return true;
     }
     require_once dirname(dirname(__DIR__)) . DS . 'helpers' . DS . 'Integrity.php';
     $integrityCheck = \Integrity::collectionIntegrityCheck($collection);
     if ($integrityCheck->status != 'ok') {
         $errorMessage = "Integrity check error:";
         foreach ($integrityCheck->errors as $error) {
             $errorMessage .= '<br>' . $error;
         }
         throw new \Exception($errorMessage);
     }
     return true;
 }