Exemple #1
0
 function upload($incVersion)
 {
     $vs = qg::remoteGet($this->name);
     if (!is_dir(sysPATH . $this->name)) {
         return false;
     }
     $v = explode('.', $vs['version']);
     $v = @array((int) $v[0], (int) $v[1], (int) $v[2]);
     foreach ($v as $i => $vp) {
         if ($i >= $incVersion) {
             $v[$i] = 0;
         }
     }
     isset($v[$incVersion - 1]) && ++$v[$incVersion - 1];
     $vs['version'] = implode('.', $v);
     $tmpFile = appPATH . 'cache/tmp/module_export1.zip';
     is_file($tmpFile) && unlink($tmpFile);
     // zzz unlink???
     require_once sysPATH . 'core/lib/file/zip.php';
     $zip = new qgZipArchive();
     $zip->open($tmpFile, ZipArchive::CREATE);
     $zip->addDir(sysPATH . $this->name, null, '/(\\.svn)|(zzz)|(yyy)/');
     $zip->close();
     $vs['size'] = filesize($tmpFile);
     $this->local_version = $vs['version'];
     @qg::Ftp()->mkdir('/module/' . $this->name . '/');
     qg::Ftp()->put('/module/' . $this->name . '/' . $vs['version'] . '.zip', $tmpFile, FTP_BINARY);
     qg::remoteSet($this->name, $vs);
     return $vs['version'];
 }
Exemple #2
0
<?php

if (!Usr()->superuser) {
    return;
}
if (isset($_GET['export'])) {
    //set_time_limit(0);
    require_once sysPATH . 'core/lib/file/zip.php';
    $tmpFile = appPATH . 'cache/tmp/pri/modExport.zip';
    is_file($tmpFile) && unlink($tmpFile);
    $zip = new qgZipArchive();
    $zip->open($tmpFile, ZipArchive::CREATE);
    $zip->addDir(appPATH . 'm', null, '/(\\.svn)/');
    $zip->addDir(appPATH . 'qg', null, '/(\\.svn)/');
    foreach (scandir(appPATH) as $file) {
        if (!is_file(appPATH . $file)) {
            continue;
        }
        if ($file === 'error_log') {
            continue;
        }
        $zip->addFile(appPATH . $file, $file);
    }
    /* only custom module:
    	foreach (qgEntry_module::all() as $name => $M) {
    		If ($M->server_time) continue;
    		$zip->addDir(sysPATH.$name, 'm/'.$name, '/(\.svn)/');
    	}
    
    	/* add mysql export */
    $structExport = '';