Метод загружает архив с данными с адреса self::ARCHIVE_URL.
@return boolean|string путь к загруженному файлу или false если файл загрузить не удалось.
@throws Exception
976712
protected function getArchive()
    {
        if (($fileData = $this->getRemoteContent(self::ARCHIVE_URL)) === false) {
            return false;
        }

        $fileName = Yii::getAlias('@runtime') . DIRECTORY_SEPARATOR . substr(strrchr(self::ARCHIVE_URL, '/'), 1);
        if (@file_put_contents($fileName, $fileData) !== false) {
            return $fileName;
        }

        return false;
    }
478104
public function process() {
        $backuptempdir = make_backup_temp_directory('');
        if ($this->filename) {
            $archivepath = $backuptempdir . '/' . $this->filename;
            if (!file_exists($archivepath)) {
                throw new restore_ui_exception('invalidrestorefile');
            }
            $outcome = $this->extract_file_to_dir($archivepath);
            if ($outcome) {
                fulldelete($archivepath);
            }
        } else {
            $fs = get_file_storage();
            $storedfile = $fs->get_file_by_hash($this->pathnamehash);
            if (!$storedfile || $storedfile->get_contenthash() !== $this->contenthash) {
                throw new restore_ui_exception('invalidrestorefile');
            }
            $outcome = $this->extract_file_to_dir($storedfile);
        }
        return $outcome;
    }
301867
public function getArchive()
    {
        $format = ($this->ArchiveType == 'Yearly') ? '%Y' : '%Y-%m';
        $publishDate = DB::get_conn()->formattedDatetimeClause('"PublishDate"', $format);
        $fields = [
            'PublishDate' => $publishDate,
            'Total' => "COUNT('\"PublishDate\"')"
        ];

        $stage = Versioned::get_stage();
        $suffix = ($stage === Versioned::LIVE) ? '_' . Versioned::LIVE : '';
        $query = SQLSelect::create($fields, '"BlogPost' . $suffix . '"')
            ->addGroupBy($publishDate)
            ->addOrderBy('"PublishDate" DESC')
            ->addWhere(['"PublishDate" <= ?' => DBDatetime::now()->Format(DBDatetime::ISO_DATETIME)]);

        $posts = $query->execute();
        $result = ArrayList::create();
        foreach ($posts as $post) {
            if ($this->ArchiveType == 'Yearly') {
                $year  = $post['PublishDate'];
                $month = null;
                $title = $year;
            } else {
                $date = DBDate::create();
                $date->setValue(strtotime($post['PublishDate']));

                $year  = $date->Format('y');
                $month = $date->Format('MM');
                $title = $date->Format('MMMM y');
            }

            $result->push(ArrayData::create([
                'Title' => $title,
                'Link' => Controller::join_links($this->Blog()->Link('archive'), $year, $month)
            ]));
        }

        $this->extend('updateGetArchive', $result);

        return $result;
    }
493019
public function getUri()
    {
        if ($this->valid() === false) {
            require_once 'Zend/Uri/Exception.php';
            throw new Zend_Uri_Exception('One or more parts of the URI are invalid');
        }

        $password = strlen($this->_password) > 0 ? ":$this->_password" : '';
        $auth     = strlen($this->_username) > 0 ? "$this->_username$password@" : '';
        $port     = strlen($this->_port) > 0 ? ":$this->_port" : '';
        $query    = strlen($this->_query) > 0 ? "?$this->_query" : '';
        $fragment = strlen($this->_fragment) > 0 ? "#$this->_fragment" : '';

        return $this->_scheme
             . '://'
             . $auth
             . $this->_host
             . $port
             . $this->_path
             . $query
             . $fragment;
    }
1107412
public function send()
    {
        $url = array_get($this->config, 'url');
        if (is_null($url)) {
            throw new Exception('Unable to find valid url. Please verify component configuration.');
        }


        $files = $this->getFiles();

        $token = csrf_token();


        $fields = array_merge([
            'url'         => $this->url,
            'description' => $this->description,
            'user_id'     => auth()->user()->id,
            'brand_id'    => app('antares.memory')->make('primary')->get('brand.default'),
            '_token'      => $token], $files);


        $headers[] = 'X-CSRF-Token:' . $token;



        $ch     = curl_init();
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        $result = curl_exec($ch);
        curl_close($ch);
        $this->cleanup($files);
        if (!$this->isJsonResponse($result)) {
            throw new Exception('Unable to send exception details to support system.');
        }
        $response = json_decode($result);

        if (isset($response->id) && (int) $response->id <= 0) {
            throw new Exception('Unable to send exception details to support system.');
        }
        return $this;
    }
746289
public function extract() {
        $zip = new ZipArchive();

        $res = $zip->open($this->_sourcePath);
        if ($res === true) {
            $zip->extractTo($this->_workingDir);
            $zip->close();
        } else {
            throw new Exception('Could not open archive ' . $this->_sourcePath);
        }
    }
198281
public function getArchiveDay()
    {
        $day = $this->request->param('Day');

        if (preg_match('/^[0-9]{1,2}$/', $day)) {
            if (checkdate($this->getArchiveMonth(), $day, $this->getArchiveYear())) {
                return (int) $day;
            }
        }

        return null;
    }
430768
public function getBackupFolder()
    {
        // Base backups folder
        $base = Yii::getAlias($this->backupsFolder);

        // Temp directory for current backup
        $current = $this->getBackupFilename();

        $fullpath = $base . DIRECTORY_SEPARATOR . $current;

        // Try to create new directory
        if (!is_dir($fullpath) && !mkdir($fullpath)) {
            throw new Exception('Can not create folder for backup: "' . $fullpath . '"');
        }

        return $fullpath;
    }
781803
public function extractHeaders(){
        $absoluteUrl = $this->getAbsoluteUrl();
        $headersArrRaw = get_headers($absoluteUrl, 1); 
        
        if($headersArrRaw === false){
            throw new \Exception("cannot get headers for {$absoluteUrl}");
        }
        
        $headersArr = array_change_key_case($headersArrRaw, CASE_LOWER);        
        if(isset($headersArr[0]) === true && strpos($headersArr[0], 'HTTP/') !== false){
            $statusStmt = $headersArr[0];
            $statusParts = explode(' ', $statusStmt);
            $headersArr['status-code'] = $statusParts[1];
            
            $statusIndex = strrpos($statusStmt, $statusParts[1])+ strlen($statusParts[1])+1;
            $headersArr['status'] = trim(substr($statusStmt, $statusIndex));
        }
        if(is_array($headersArr['content-type']) === true){
            $headersArr['content-type'] = end($headersArr['content-type']);
        }
        
        return $headersArr;
    }
74732
public function getArchiveYear()
    {
        if ($this->request->param('Year')) {
            if (preg_match('/^[0-9]{4}$/', $year = $this->request->param('Year'))) {
                return (int) $year;
            }
        } elseif ($this->request->param('Action') == 'archive') {
            return DBDatetime::now()->Year();
        }

        return null;
    }
964141
public function getArchived()
    {
        if (!$this->isArchivable()) {
            return false;
        }
        if (empty($this->owner->{$this->archiveField})) {
            return false;
        }

        return true;
    }
486018
public static function getArchiveSlug()
    {
        global $wp_query;

        if ($wp_query && !is_tax() && (is_post_type_archive() || is_archive() || is_home() || is_search() || is_404())) {
            $postType = get_post_type();

            if (isset($wp_query->query_vars['post_type']) && !empty($wp_query->query_vars['post_type'])) {
                $postType = $wp_query->query_vars['post_type'];
            }

            if (is_home()) {
                $archiveSlug = 'archive-post';
            } elseif (is_post_type_archive() && is_search()) {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            } elseif (is_search()) {
                $archiveSlug = 'search';
            } elseif (is_404()) {
                $archiveSlug = 'e404';
            } elseif (is_author()) {
                $archiveSlug = 'author';
            } else {
                $archiveSlug = 'archive-' . get_post_type_object($postType)->name;
            }

            return $archiveSlug;
        }

        return false;
    }
106754
protected function archive()
    {
        if( $archiveDatabaseList = $this->getArchiveDatabaseList() )
        {
            foreach( $archiveDatabaseList as $database )
            {
                if( ! empty($tables = $this->getArchiveDatabaseTableList($database)) )
                {
                    $dbForge = $this->getDBForgeDifferentConnectionByDatabaseName($database);
    
                    foreach( $tables as $table )
                    {
                        $dbForge->dropTable($this->getTableNameWithoutExtension($table));
                    }
                }
    
                $tool = $this->getDBToolDifferentConnectionByDatabaseName($database);
    
                if( empty($tool->listTables()) )
                {
                    $this->forge->dropDatabase($database);
                }
            }

            return true;
        }
        
        return false;
    }
294806
private function ArchiveCategoryValue()
    {
        if (!$this->articleList->Exists()) {
            return '';
        }
        $archive = Archive::Schema()->ByPage($this->Page());
        if ($archive) {
            return $archive->GetID();
        }
        $category = Category::Schema()->ByPage($this->Page());
        if ($category) {
            return $category->GetArchive()->GetID() . '-' .
                    $category->GetID();
        }
    }
1037377
public function getFilePath() {

		if( isset( $this->url ) ) {

			return Yii::$app->fileManager->uploadDir . '/' . $this->url;
		}

		return false;
	}
711739
public function archive()
    {
        if (!is_string($this->pharName) || strlen($this->pharName) <= 0) {
            return false;
        }
        if (!is_string($this->directory) || strlen($this->directory) <= 0) {
            return false;
        }
        if (!is_string($this->outputDirectory) || strlen($this->outputDirectory) <= 0) {
            return false;
        }

        $file = $this->getPharFileName();

        $phar = new Phar(
            $this->outputDirectory . '/' . $file,
            FilesystemIterator::CURRENT_AS_FILEINFO | FilesystemIterator::KEY_AS_FILENAME,
            $file
        );

        // 开始打包
        $phar->startBuffering();

        // 将后缀名相关的文件打包
        if (is_array($this->extensions)) {
            foreach ($this->extensions as $ext) {
                $phar->buildFromDirectory($this->directory, '/\.' . $ext . '$/');
            }
        }

        // 把builder本身摘除
        if (is_array($this->excludeEntries)) {
            foreach ($this->excludeEntries as $entry) {
                //such as $phar->delete('build.php');
                $phar->delete($entry);
            }
        }

        // 设置入口
        if ($this->bootstrapStub !== null) $phar->setStub($this->bootstrapStub);

        $phar->stopBuffering();

        // 打包完成
        return true;
    }
76524
public function getURL() {

        if ($this->_generatedURL != "")
            return $this->_generatedURL;

        if (!isset($this->_merchantID))
            throw new Exception('Merchant ID not set, use the setMerchantID() method');
        if (!isset($this->_secretCode))
            throw new Exception('Secretcode ID not set, use the setSecretCode() method');

        if (!isset($this->data->ic_country)) {
            if (count($this->_country) == 1) {
                $this->data->ic_country = current($this->_country);
            } else
                $this->data->ic_country = $this->_defaultCountryCode;
        }

        if (!isset($this->data->ic_issuer) && isset($this->data->ic_paymentmethod)) {
            if (count($this->_issuer) == 1) {
                $this->data->ic_issuer = current($this->_issuer);
            } else
                throw new Exception('Issuer not set, use the setIssuer() method');
        }

        if (!isset($this->data->ic_language)) {
            if (count($this->_language) == 1) {
                $this->data->ic_language = current($this->_language);
            } else
                throw new Exception('Language not set, use the setLanguage() method');
        }

        if (!isset($this->data->ic_currency)) {
            if (count($this->_currency) == 1) {
                $this->data->ic_currency = current($this->_currency);
            } else
                throw new Exception('Currency not set, use the setCurrency() method');
        }

        if (!isset($this->data->ic_amount))
            throw new Exception('Amount not set, use the setAmount() method');

        if (!isset($this->data->ic_orderid))
            throw new Exception('OrderID not set, use the setOrderID() method');

        if (!isset($this->data->ic_reference))
            $this->data->ic_reference = "";
        if (!isset($this->data->ic_description))
            $this->data->ic_description = "";

        /*
         * Dynamic URLs
         * @since 1.0.1
         */
        if (!isset($this->data->ic_urlcompleted))
            $this->data->ic_urlcompleted = "";
        if (!isset($this->data->ic_urlerror))
            $this->data->ic_urlerror = "";

        $this->data->ic_version = $this->_checkout_version;
        $this->data->ic_merchantid = $this->_merchantID;
        $this->data->chk = $this->generateCheckSumDynamic();

        /* @since version 1.0.2 */
        if ($this->_webservice) {
            require_once(DIR . DS . "icepay_api_webservice.php");

            if (!isset($this->data->ic_issuer) || $this->data->ic_issuer == "")
                throw new Exception("Issuer not set");

            //$ws = Icepay_Api_Webservice::getInstance()->paymentService();
            $ws = Icepay_Api_Webservice::getInstance()->paymentService();
            $ws->setMerchantID($this->_merchantID)
                    ->setSecretCode($this->_secretCode)
                    ->setSuccessURL($this->data->ic_urlcompleted)
                    ->setErrorURL($this->data->ic_urlerror);
            try {
                $this->_generatedURL = $ws->checkOut($this->paymentObj, true);
            } catch (Exception $e) {
                throw new Exception($e->getMessage());
            }
            return $this->_generatedURL;
        }

        if (isset($this->data->ic_paymentmethod)) {
            $this->_generatedURL = $this->postRequest($this->basicMode(), $this->prepareParameters());
        } else {
            $this->_generatedURL = sprintf("%s&%s", $this->basicMode(), $this->prepareParameters());
        }

        return $this->_generatedURL;
    }