コード例 #1
0
 /**
  * If not empty, the returned string is rendered below the common title.
  *
  * @return string
  */
 public function getStrLongDescription()
 {
     if ($this->objMetadata == null) {
         return "";
     }
     return $this->objMetadata->getStrDescription();
 }
コード例 #2
0
 public function testExtractAndMove()
 {
     $objFilesystem = new class_filesystem();
     $objFilesystem->folderCreate(_projectpath_ . "/temp/moduletest");
     file_put_contents(_realpath_ . _projectpath_ . "/temp/moduletest/metadata.xml", $this->getStrMetadata());
     $objFilesystem->folderCreate(_projectpath_ . "/temp/moduletest/system");
     file_put_contents(_realpath_ . _projectpath_ . "/temp/moduletest/system/test.txt", $this->getStrMetadata());
     $objZip = new class_zip();
     $objZip->openArchiveForWriting(_projectpath_ . "/temp/autotest.zip");
     $objZip->addFile(_projectpath_ . "/temp/moduletest/metadata.xml", "/metadata.xml");
     $objZip->addFile(_projectpath_ . "/temp/moduletest/system/test.txt", "/system/test.txt");
     $objZip->closeArchive();
     $objFilesystem->folderDeleteRecursive(_projectpath_ . "/temp/moduletest/");
     $objManager = new class_module_packagemanager_manager();
     $objPackageManager = $objManager->getPackageManagerForPath(_projectpath_ . "/temp/autotest.zip");
     $this->assertEquals(get_class($objPackageManager), "class_module_packagemanager_packagemanager_module");
     $objPackageManager = $objManager->extractPackage(_projectpath_ . "/temp/autotest.zip");
     $this->assertEquals(get_class($objPackageManager), "class_module_packagemanager_packagemanager_module");
     $objPackageManager->move2Filesystem();
     $this->assertFileExists(_realpath_ . "/core/module_autotest/metadata.xml");
     $this->assertFileExists(_realpath_ . "/core/module_autotest/system/test.txt");
     $objMetadata = new class_module_packagemanager_metadata();
     $objMetadata->autoInit("/core/module_autotest/");
     $this->assertEquals("Autotest", $objMetadata->getStrTitle());
     $this->assertEquals("", $objMetadata->getStrDescription());
     $this->assertEquals("3.9.1", $objMetadata->getStrVersion());
     $this->assertEquals("Kajona Team", $objMetadata->getStrAuthor());
     $this->assertEquals("module_autotest", $objMetadata->getStrTarget());
     $this->assertEquals(class_module_packagemanager_manager::STR_TYPE_MODULE, $objMetadata->getStrType());
     $this->assertEquals(false, $objMetadata->getBitProvidesInstaller());
     $arrRequired = $objMetadata->getArrRequiredModules();
     $arrModules = array_keys($arrRequired);
     $arrVersion = array_values($arrRequired);
     $this->assertEquals("system", $arrModules[0]);
     $this->assertEquals("3.4.1", $arrVersion[0]);
     $this->assertEquals("pages", $arrModules[1]);
     $this->assertEquals("3.4.2", $arrVersion[1]);
     $arrImages = $objMetadata->getArrScreenshots();
     $this->assertEquals(1, count($arrImages));
     $this->assertEquals("/test.jpg", $arrImages[0]);
     $objFilesystem->folderDeleteRecursive("/core/module_autotest");
     $objFilesystem->fileDelete(_projectpath_ . "/temp/autotest.zip");
 }
コード例 #3
0
 /**
  * Copies the metadata.xml content into the files properties.
  * @permissions edit
  * @xml
  * @return string
  */
 protected function actionUpdateDataFromMetadata()
 {
     $objPackage = new class_module_mediamanager_file($this->getSystemid());
     $objZip = new class_zip();
     $strMetadata = $objZip->getFileFromArchive($objPackage->getStrFilename(), "/metadata.xml");
     if ($strMetadata !== false) {
         $objMetadata = new class_module_packagemanager_metadata();
         $objMetadata->autoInit($objPackage->getStrFilename());
         $objPackage->setStrName($objMetadata->getStrTitle());
         $objPackage->setStrDescription($objMetadata->getStrDescription());
         //updateObjectToDb triggers the update of the isPackage and the category flags
         $objPackage->updateObjectToDb();
         return "<message><success /></message>";
     }
     return "<message><error /></message>";
 }