コード例 #1
0
ファイル: UtilTest.php プロジェクト: aladin1394/CM
 public function testGetResourceFiles()
 {
     $files = CM_Util::getResourceFiles('config/default.php');
     if (!count($files)) {
         $this->markTestSkipped('There are no files to test this functionality');
     }
     foreach ($files as $file) {
         $this->assertInstanceOf('CM_File', $file);
         $this->assertSame('default.php', $file->getFileName());
     }
 }
コード例 #2
0
ファイル: SetupScript.php プロジェクト: cargomedia/cm
 public function load(CM_OutputStream_Interface $output)
 {
     $mysqlDbClient = $this->getServiceManager()->getDatabases()->getMaster();
     $databaseName = $mysqlDbClient->getDatabaseName();
     $mysqlClient = $mysqlDbClient->getClientWithoutDatabase();
     $mysqlClient->createStatement('CREATE DATABASE ' . $mysqlClient->quoteIdentifier($databaseName))->execute();
     foreach (CM_Util::getResourceFiles('db/structure.sql') as $dump) {
         CM_Db_Db::runDump($databaseName, $dump);
     }
     $this->_setInitialVersion();
 }
コード例 #3
0
ファイル: SetupScript.php プロジェクト: cargomedia/cm
 public function load(CM_OutputStream_Interface $output)
 {
     $mongoClient = $this->getServiceManager()->getMongoDb();
     foreach (CM_Util::getResourceFiles('mongo/collections.json') as $dump) {
         $collectionInfo = CM_Params::jsonDecode($dump->read());
         foreach ($collectionInfo as $collection => $indexes) {
             $mongoClient->createCollection($collection);
             foreach ($indexes as $indexInfo) {
                 $mongoClient->createIndex($collection, $indexInfo['key'], $indexInfo['options']);
             }
         }
     }
 }
コード例 #4
0
ファイル: Translations.php プロジェクト: NicolasSchmutz/cm
 public function load(CM_OutputStream_Interface $output)
 {
     /** @var CM_Model_Language $language */
     foreach (new CM_Paging_Language_All() as $language) {
         $path = 'translations/' . $language->getAbbreviation() . '.php';
         foreach (CM_Util::getResourceFiles($path) as $translationsFile) {
             $translationsSetter = (require $translationsFile->getPath());
             if (!$translationsSetter instanceof Closure) {
                 throw new CM_Exception_Invalid('Invalid translation file. `' . $translationsFile->getPath() . '` must return callable');
             }
             $translationsSetter($language);
         }
     }
     $this->_setLoaded(true);
 }
コード例 #5
0
ファイル: Node.php プロジェクト: cargomedia/cm
 /**
  * @param string $configBasename
  * @throws CM_Exception_Invalid
  */
 public function extend($configBasename)
 {
     foreach (CM_Util::getResourceFiles('config/' . $configBasename) as $configFile) {
         $this->extendWithFile($configFile);
     }
 }