Exemple #1
0
 public function UnInstallFiles()
 {
     $files = array('js' => '/js/' . $this->MODULE_ID, 'img' => '/images/' . $this->MODULE_ID, 'request' => '/tools/' . $this->MODULE_ID);
     $rootDir = Application::getDocumentRoot() . '/' . ltrim(Application::getPersonalRoot(), '/');
     foreach ($files as $file) {
         Directory::deleteDirectory($rootDir . $file);
     }
 }
 protected static function deleteDirectory($path)
 {
     if (\Bitrix\Main\IO\Directory::isDirectoryExists($path)) {
         \Bitrix\Main\IO\Directory::deleteDirectory($path);
     }
 }
 public function getRemoteTypeGroups()
 {
     if (!$this->useCache || !isset($this->data['settings']['remote']['typeGroups'])) {
         $localPath = \CTempFile::GetDirectoryName(100);
         static::downloadFile(self::REMOTE_TYPE_GROUP_FILE, self::LOCAL_TYPE_GROUP_FILE, false, $localPath);
         $csv = new CSVReader();
         $res = $csv->ReadBlock($localPath . self::LOCAL_TYPE_GROUP_FILE);
         $result = array();
         foreach ($res as $line) {
             $result[$line['CODE']] = explode(':', $line['TYPES']);
         }
         $this->data['settings']['remote']['typeGroups'] = $result;
         if (\Bitrix\Main\IO\File::isFileExists($localPath . self::LOCAL_TYPE_GROUP_FILE)) {
             try {
                 \Bitrix\Main\IO\File::deleteFile($localPath . self::LOCAL_TYPE_GROUP_FILE);
                 \Bitrix\Main\IO\Directory::deleteDirectory($localPath);
             } catch (\Exception $e) {
             }
         }
     }
     return $this->data['settings']['remote']['typeGroups'];
 }
Exemple #4
0
 protected static function cleanWorkDirectory()
 {
     $dir = $_SERVER['DOCUMENT_ROOT'] . self::LOCAL_PATH . self::LOCAL_SETS_PATH;
     IO\Directory::deleteDirectory($dir);
     IO\Directory::createDirectory($dir);
 }
Exemple #5
0
 /**
  * @return bool
  */
 function UnInstallFiles()
 {
     \Bitrix\Main\IO\Directory::deleteDirectory($_SERVER["DOCUMENT_ROOT"] . '/bitrix/components/adelshin/');
     if (\Bitrix\Main\IO\Directory::isDirectoryExists($path = $this->GetPath() . '/admin')) {
         // удаляем административные файлы
         DeleteDirFiles($_SERVER["DOCUMENT_ROOT"] . $this->GetPath() . '/install/admin/', $_SERVER["DOCUMENT_ROOT"] . '/bitrix/admin');
         if ($dir = opendir($path)) {
             while (false !== ($item = readdir($dir))) {
                 if (in_array($item, $this->exclusionAdminFiles)) {
                     continue;
                 }
                 \Bitrix\Main\IO\File::deleteFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/admin/' . $this->MODULE_ID . '_' . $item);
             }
             closedir($dir);
         }
     }
     return true;
 }