コード例 #1
0
ファイル: InventoryGetApi.php プロジェクト: jkinner/ringside
 /**
  * Returns an array containing information on an API.
  *
  * @return array info on an API
  */
 public function execute()
 {
     $_apiNamePieces = explode('.', $this->apiName);
     $_apiNamespace = $_apiNamePieces[0];
     $_apiPkg = $_apiNamePieces[1];
     $_apiShortName = $_apiNamePieces[2];
     $_apiClassFile = ucfirst($_apiPkg) . ucfirst($_apiShortName) . '.php';
     // we need to scan the rest locations so we can get the full path info
     $_restLocations = M3_Util_Settings::getRestLocations();
     $_deployedApiLocations = M3_Util_Settings::getDeployedApiLocations();
     $_foundPathname = null;
     foreach ($_restLocations as $_restLocation) {
         foreach ($_deployedApiLocations as $_deployedApiLocation) {
             $_dir = M3_Util_File::buildPathName($_restLocation, $_deployedApiLocation);
             $_pathname = M3_Util_File::buildPathName($_dir, $_apiClassFile);
             if (file_exists($_pathname)) {
                 $_foundPathname = $_pathname;
                 break;
             }
         }
         if (!is_null($_foundPathname)) {
             break;
         }
     }
     $_info = array();
     if (!is_null($_foundPathname)) {
         $_info['api_name'] = $this->apiName;
         $_info['pathname'] = $_foundPathname;
     }
     return array('api' => $_info);
 }
コード例 #2
0
ファイル: InventoryGetApis.php プロジェクト: jkinner/ringside
 /**
  * Returns an array containing the full dot-notation names of all deployed APIs
  * and their php implementation filenames.
  * The API names are grouped by their namespaces in the returned multi-dimensional array.
  *
  * @return array all APIs deployed in the server. The returned array is associative with
  *         the key being the namespace name and value being another associative array
  *         keyed on API name whose value is the filename of the API implementation php file. 
  */
 private function getAllApiNames()
 {
     $_apiDirectories = M3_Util_Settings::getDeployedApiLocations();
     foreach ($_apiDirectories as $_apiDirectory) {
         $_apiNamespace = str_replace("/", ".", ltrim($_apiDirectory, '/'));
         if (substr($_apiNamespace, -5) == ".rest") {
             $_apiNamespace = substr($_apiNamespace, 0, -5);
         } else {
             if ($_apiNamespace = "ringside.api.facebook") {
                 $_apiNamespace = "facebook";
             }
         }
         $_apis[$_apiNamespace] = $this->getApiNamesInDirectory($_apiNamespace, $_apiDirectory);
     }
     return $_apis;
 }
コード例 #3
0
ファイル: SettingsTestCase.php プロジェクト: jkinner/ringside
 public function testSettings()
 {
     $_allowEval = M3_Util_Settings::getAllowOperationEvaluatePhpCode();
     $this->assertType('boolean', $_allowEval);
     $_maxSizeAllowedFileContent = M3_Util_Settings::getMaxSizeAllowedOperationGetFileContent();
     $this->assertGreaterThanOrEqual(0, $_maxSizeAllowedFileContent);
     $_dataDir = M3_Util_Settings::getDataDirectory();
     $this->assertFalse(empty($_dataDir));
     $_dataStoreEnum = M3_Util_Settings::getDatastore();
     $this->assertFalse(empty($_dataStoreEnum));
     $this->assertType(M3_Util_DatastoreEnum, $_dataStoreEnum);
     $_dirs = M3_Util_Settings::getDeployedApiLocations();
     $this->assertEquals(3, count($_dirs));
     $this->assertContains('/ringside/rest', $_dirs);
     $this->assertContains('/m3/rest', $_dirs);
     $this->assertContains('/ringside/api/facebook', $_dirs);
     $_php = M3_Util_Settings::getPhpIniFileLocation();
     $this->assertGreaterThan(strlen("php.ini"), strlen($_php), "should be a full path to the php.ini file");
     $_phpContent = M3_Util_Settings::getPhpIniSettings();
     $this->assertTrue(!empty($_phpContent));
     $_dbProfileEnable = M3_Util_Settings::getDbProfilerEnable();
     $this->assertNotNull($_dbProfileEnable);
     $this->assertTrue($_dbProfileEnable === true || $_dbProfileEnable === false, "Should have been a boolean");
 }