当前位置: 首页>>代码示例>>PHP>>正文


PHP G::rm_dir方法代码示例

本文整理汇总了PHP中G::rm_dir方法的典型用法代码示例。如果您正苦于以下问题:PHP G::rm_dir方法的具体用法?PHP G::rm_dir怎么用?PHP G::rm_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在G的用法示例。


在下文中一共展示了G::rm_dir方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run_flush_cache

function run_flush_cache($args, $opts)
{
    $rootDir = realpath(__DIR__."/../../../../");
    $app = new Maveriks\WebApplication();
    $app->setRootDir($rootDir);
    $loadConstants = false;
    $workspaces = get_workspaces_from_args($args);

    if (! defined("PATH_C")) {
        die("ERROR: seems processmaker is not properly installed (System constants are missing).".PHP_EOL);
    }

    CLI::logging("Flush ".pakeColor::colorize("system", "INFO")." cache ... ");
    G::rm_dir(PATH_C);
    G::mk_dir(PATH_C, 0777);
    echo "DONE" . PHP_EOL;

    foreach ($workspaces as $workspace) {
        echo "Flush workspace " . pakeColor::colorize($workspace->name, "INFO") . " cache ... ";

        G::rm_dir($workspace->path . "/cache");
        G::mk_dir($workspace->path . "/cache", 0777);
        G::rm_dir($workspace->path . "/cachefiles");
        G::mk_dir($workspace->path . "/cachefiles", 0777);
        echo "DONE" . PHP_EOL;
    }
}
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:27,代码来源:cliFlushCache.php

示例2: runHotfixInstall

function runHotfixInstall($command, $args)
{
    CLI::logging("HOTFIX", PATH_DATA . "log" . PATH_SEP . "upgrades.log");
    CLI::logging("Install hotfix to system\n");
    $arrayFile = $command;
    if (count($arrayFile) > 0) {
        //Install hotfix
        foreach ($arrayFile as $value) {
            $f = $value;
            $result = workspaceTools::hotfixInstall($f);
            CLI::logging($result["message"] . "\n");
        }
        //Clear server's cache
        CLI::logging("\nClearing cache...\n");
        if (defined("PATH_C")) {
            G::rm_dir(PATH_C);
            G::mk_dir(PATH_C, 0777);
        }
        //Safe upgrade for JavaScript files
        CLI::logging("\nSafe upgrade for files cached by the browser\n\n");
        G::browserCacheFilesSetUid();
        CLI::logging("HOTFIX done\n");
    } else {
        CLI::logging("Please specify the hotfix to install\n");
    }
}
开发者ID:emildev35,项目名称:processmaker,代码行数:26,代码来源:cliHotfix.php

示例3: pluginUninstall

 public function pluginUninstall($pluginName)
 {
     //define("PATH_PLUGINS", PATH_CORE . "plugins" . PATH_SEP);
     if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php")) {
         require_once PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php";
         $pluginRegistry =& PMPluginRegistry::getSingleton();
         $pluginDetail = $pluginRegistry->getPluginDetails($pluginName . ".php");
         if ($pluginDetail) {
             $pluginRegistry->enablePlugin($pluginDetail->sNamespace);
             $pluginRegistry->disablePlugin($pluginDetail->sNamespace);
             ///////
             $plugin = new $pluginDetail->sClassName($pluginDetail->sNamespace, $pluginDetail->sFilename);
             //$this->_aPlugins[$pluginDetail->sNamespace] = $plugin;
             if (method_exists($plugin, "uninstall")) {
                 $plugin->uninstall();
             }
             ///////
             file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
         }
         ///////
         unlink(PATH_CORE . "plugins" . PATH_SEP . $pluginName . ".php");
         if (file_exists(PATH_CORE . "plugins" . PATH_SEP . $pluginName)) {
             G::rm_dir(PATH_CORE . "plugins" . PATH_SEP . $pluginName);
         }
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:26,代码来源:enterprise.php

示例4: rm_dir

 /**
  * rm_dir
  *
  * @param string $dirName
  *
  * @return void
  */
 public function rm_dir($dirName)
 {
     if (!is_writable($dirName)) {
         return false;
     }
     if (is_dir($dirName)) {
         foreach (glob($dirName . '/{,.}*', GLOB_BRACE) as $file) {
             if ($file == $dirName . '/.' || $file == $dirName . '/..') {
                 continue;
             }
             if (is_dir($file)) {
                 G::rm_dir($file);
             } else {
                 @unlink($file);
             }
         }
         if (strtoupper(substr(PHP_OS, 0, 3)) === "WIN") {
             $dirName = str_replace("/", "\\", $dirName);
             exec("DEL /F /S /Q " . $dirName . "", $res);
             exec("RD /S /Q " . $dirName . "", $res);
         } else {
             @rmdir($dirName);
         }
     } else {
         @unlink($dirName);
     }
 }
开发者ID:nhenderson,项目名称:processmaker,代码行数:34,代码来源:class.g.php

示例5: uninstallPlugin

    public function uninstallPlugin ($sNamespace)
    {
        $pluginFile = $sNamespace . ".php";

        if (! file_exists( PATH_PLUGINS . $pluginFile )) {
            throw (new Exception( "File \"$pluginFile\" doesn't exist" ));
        }

        ///////
        $path = PATH_PLUGINS . $pluginFile;
        G::LoadSystem('inputfilter');
        $filter = new InputFilter();
        $path = $filter->validateInput($path, 'path');
        require_once ($path);

        foreach ($this->_aPluginDetails as $namespace => $detail) {
            if ($namespace == $sNamespace) {
                $this->enablePlugin( $detail->sNamespace );
                $this->disablePlugin( $detail->sNamespace );

                ///////
                $plugin = new $detail->sClassName( $detail->sNamespace, $detail->sFilename );
                $this->_aPlugins[$detail->sNamespace] = $plugin;

                if (method_exists( $plugin, "uninstall" )) {
                    $plugin->uninstall();
                }

                ///////
                $this->save();
                ///////
                $pluginDir = PATH_PLUGINS . $detail->sPluginFolder;

                if (isset( $detail->sFilename ) && ! empty( $detail->sFilename ) && file_exists( $detail->sFilename )) {
                    unlink( $detail->sFilename );
                }

                if (isset( $detail->sPluginFolder ) && ! empty( $detail->sPluginFolder ) && file_exists( $pluginDir )) {
                    G::rm_dir( $pluginDir );
                }

                ///////
                $this->uninstallPluginWorkspaces( array ($sNamespace
                ) );
                ///////
                break;
            }
        }
    }
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:49,代码来源:class.pluginRegistry.php

示例6: trim

                 if (strcasecmp(trim($params[0]), "filename") == 0) {
                     $fileName = trim($params[1], "\" ");
                 }
             }
         }
     }
 }
 if (preg_match("/^.*json.*\$/i", $fileContentType)) {
     $r = G::json_decode(stream_get_contents($fileData));
     if ($r->status == "ERROR") {
         throw new Exception($r->message);
     }
 }
 ///////
 $dir = PATH_DATA . "upgrade" . PATH_SEP . "processmaker";
 G::rm_dir($dir);
 G::mk_dir($dir);
 if (!file_exists($dir)) {
     throw new Exception("Could not create destination directory.");
 }
 ///////
 $fileName = $dir . PATH_SEP . $fileName;
 $file = @fopen($fileName, "wb");
 if ($file === false) {
     throw new Exception("Could not open destination file.");
 }
 while (!feof($fileData)) {
     $data = fread($fileData, BUFSIZE);
     //Just to be safe, check all error conditions
     if ($data === "" || $data === false) {
         break;
开发者ID:emildev35,项目名称:processmaker,代码行数:31,代码来源:processMakerAjax.php

示例7: cleanupUpgradeDirectory

 /**
  * This function does to clean up to the upgrate directory
  *
  *
  * @name cleanupUpgradeDirectory
  *
  * param
  * @return array
  */
 public function cleanupUpgradeDirectory()
 {
     G::rm_dir(PATH_DATA . "upgrade" . PATH_SEP . "processmaker");
 }
开发者ID:bqevin,项目名称:processmaker,代码行数:13,代码来源:class.system.php

示例8: run_drafts_clean


//.........这里部分代码省略.........



  if ($allDrafts)

    echo "Removing all drafts\n";

  else

    echo "Removing drafts older than " . $days . " days\n";



  /* Load the configuration from the workspace */

  require_once( PATH_DB . $workspace . '/db.php' );

  require_once( PATH_THIRDPARTY . 'propel/Propel.php');



  PROPEL::Init ( PATH_METHODS.'dbConnections/rootDbConnections.php' );

  $con = Propel::getConnection("root");



  $stmt = $con->createStatement();



  if (!$allDrafts)

    $dateSql = "AND DATE_SUB(CURDATE(),INTERVAL " . $days . " DAY) >= APP_CREATE_DATE";

  else

    $dateSql = "";

  /* Search for all the draft cases */

  $sql = "SELECT APP_UID FROM APPLICATION WHERE APP_STATUS='DRAFT'" . $dateSql;

  $appRows = $stmt->executeQuery($sql, ResultSet::FETCHMODE_ASSOC);



  /* Tables to remove the cases from */

  $tables = array(

      "APPLICATION",

      "APP_DELEGATION",

      "APP_CACHE_VIEW",

      "APP_THREAD",

      "APP_DOCUMENT",

      "APP_EVENT",

      "APP_HISTORY",

      "APP_MESSAGE"

  );



  echo "Found " . $appRows->getRecordCount() . " cases to remove";

  foreach ($appRows as $row) {

    echo ".";

    $appUid = $row['APP_UID'];

    foreach ($tables as $table) {

      delete_app_from_table($con, $table, $appUid);

    }

    delete_app_from_table($con, "CONTENT", $appUid, "CON_ID");

    if (file_exists(PATH_DB . $workspace . '/files/'. $appUid)) {

      echo "\nRemoving files from " . $appUid . "\n";

      G::rm_dir(PATH_DB . $workspace . '/files/'. $appUid);

    }

  }

  echo "\n";

}
开发者ID:hpx2206,项目名称:processmaker-1,代码行数:101,代码来源:cliWorkspaces.php

示例9: catch

            }
        } else {
            if (isset($_POST["metadataCache"])) {
                G::rm_dir(PATH_C . "xmlform");
                $response->xmlform = true;
                $msgLog = $msgLog . "Forms Metadata Cache";
                if (isset($_POST["htmlCache"])) {
                    G::rm_dir(PATH_C . "smarty");
                    $response->smarty = true;
                    $msgLog = $msgLog . " and Forms Html Templates Cache.";
                } else {
                    $msgLog = $msgLog . ".";
                }
            } else {
                if (isset($_POST["htmlCache"])) {
                    G::rm_dir(PATH_C . "smarty");
                    $response->smarty = true;
                    $msgLog = $msgLog . "Forms Html Templates Cache.";
                }
            }
        }
        $response->success = true;
        G::auditLog("ClearCache", $msgLog);
    } else {
        $response->success = false;
    }
} catch (Exception $e) {
    $response->success = false;
    $response->message = $e->getMessage();
}
echo G::json_encode($response);
开发者ID:emildev35,项目名称:processmaker,代码行数:31,代码来源:clearCompiledAjax.php

示例10: catch

<?php

try {
    if (isset($_POST['javascriptCache']) || isset($_POST['metadataCache']) || isset($_POST['htmlCache'])) {
        if (isset($_POST['javascriptCache'])) {
            G::rm_dir(PATH_C . 'ExtJs');
            $response->javascript = true;
        }
        if (isset($_POST['metadataCache'])) {
            G::rm_dir(PATH_C . 'xmlform');
            $response->xmlform = true;
        }
        if (isset($_POST['htmlCache'])) {
            G::rm_dir(PATH_C . 'smarty');
            $response->smarty = true;
        }
        $response->success = true;
    } else {
        $response->success = false;
    }
} catch (Exception $e) {
    $response->success = false;
    $response->message = $e->getMessage();
}
echo G::json_encode($response);
开发者ID:nshong,项目名称:processmaker,代码行数:25,代码来源:clearCompiledAjax.php

示例11: rm_dir

 /**
  * rm_dir
  *
  * @param  string $dirName
  *
  * @return void
  */
 function rm_dir($dirName)
 {
     if (!is_writable($dirName)) {
         return false;
     }
     if (is_dir($dirName)) {
         foreach (glob($dirName . '/*') as $file) {
             if (is_dir($file)) {
                 G::rm_dir($file);
                 if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
                     exec('DEL /F /S /Q %' . $dirName . '%', $res);
                 } else {
                     @rmdir($file);
                 }
             } else {
                 @unlink($file);
             }
         }
     } else {
         @unlink($dirName);
     }
 }
开发者ID:nshong,项目名称:processmaker,代码行数:29,代码来源:class.g.php

示例12: workspaceRestore

function workspaceRestore($backupFilename, $targetWorkspace, $overwrite)
{
    $tempDirectory = tempnam(__FILE__, '');
    if (file_exists($tempDirectory)) {
        unlink($tempDirectory);
    }
    if (file_exists($tempDirectory)) {
        G::rm_dir($tempDirectory);
    }
    G::mk_dir($tempDirectory);
    G::LoadThirdParty('pear/Archive', 'Tar');
    $tar = new Archive_Tar($backupFilename);
    $res = $tar->extract($tempDirectory);
    $metadataFilename = $tempDirectory . PATH_SEP . 'metadata.txt';
    if (!file_exists($metadataFilename)) {
        /* Look for legacy backups, where metadata was stored as a file with the
         * workspace name, such as workflow.txt
         * This means the backup filename must be the same as the metadata file.
         */
        $info = pathinfo($backupFilename);
        /* Check if it's a compressed backup, in which case we need to remove
         * both the gz and the tar extensions.
         */
        if ($info['extension'] == "gz") {
            $info = pathinfo(basename($backupFilename, '.' . $info['extension']));
        }
        $wsNameFromTar = basename($backupFilename, '.' . $info['extension']);
        $metadataFilename = $tempDirectory . PATH_SEP . $wsNameFromTar . '.txt';
        if (!file_exists($metadataFilename)) {
            throw new Exception("Metadata file was not found in backup");
        }
    }
    $metadata = unserialize(file_get_contents($metadataFilename));
    $backupWorkspace = $metadata['WORKSPACE_NAME'];
    $changeWorkspace = isset($targetWorkspace);
    if (!$changeWorkspace) {
        $targetWorkspace = $backupWorkspace;
    } else {
        echo "Restoring from workspace: " . pakeColor::colorize($backupWorkspace, 'INFO') . "\n";
    }
    echo "Restoring to workspace:   " . pakeColor::colorize($targetWorkspace, 'INFO') . "\n";
    //moving the site files
    $backupWorkspaceDir = $tempDirectory . PATH_SEP . $backupWorkspace;
    $targetWorkspaceDir = PATH_DATA . 'sites' . PATH_SEP . $targetWorkspace;
    if (!$overwrite && file_exists($targetWorkspaceDir)) {
        $overwrite = strtolower(prompt('Workspace already exists, do you want to overwrite? [Y/n]'));
        if (array_search(trim($overwrite), array("y", "")) === false) {
            die;
        }
        $overwrite = true;
    }
    printf("Moving files to %s \n", pakeColor::colorize($targetWorkspaceDir, 'INFO'));
    /* We already know we will be overwriting the new workspace if we reach this
     * point, so remove the workspace directory if it exists.
     */
    if (file_exists($targetWorkspaceDir)) {
        G::rm_dir($targetWorkspaceDir);
    }
    if (!rename($backupWorkspaceDir, $targetWorkspaceDir)) {
        throw new Exception("There was an error moving from {$backupWorkspaceDir} to {$targetWorkspaceDir}");
    }
    $dbOpt = @explode(SYSTEM_HASH, G::decrypt(HASH_INSTALLATION, SYSTEM_HASH));
    $dbHostname = $dbOpt[0];
    /* TODO: Check if database exists after updateDBfile */
    $config = updateDBfile($targetWorkspaceDir, $targetWorkspace, $dbHostname, $changeWorkspace);
    G::LoadSystem('dbMaintenance');
    $oDbMaintainer = new DataBaseMaintenance($dbOpt[0], $dbOpt[1], $dbOpt[2]);
    $dbName = $config['DB_NAME'];
    $dbUser = $config['DB_USER'];
    $dbPass = $config['DB_PASS'];
    restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite);
    $dbName = $config['DB_RBAC_NAME'];
    $dbUser = $config['DB_RBAC_USER'];
    $dbPass = $config['DB_RBAC_PASS'];
    restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_RBAC_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite);
    $dbName = $config['DB_REPORT_NAME'];
    $dbUser = $config['DB_REPORT_USER'];
    $dbPass = $config['DB_REPORT_PASS'];
    restoreDB($dbHostname, $oDbMaintainer, $metadata['DB_REPORT_NAME'], $dbName, $dbUser, $dbPass, $tempDirectory, $overwrite);
    echo "\n";
    $wsInfo = getSysInfo();
    $wsInfo['WORKSPACE_NAME'] = $targetWorkspace;
    $wsInfo = array_merge($wsInfo, $config);
    printInfoSites($metadata, $wsInfo);
    return true;
}
开发者ID:bqevin,项目名称:processmaker,代码行数:86,代码来源:pakeGulliver.php

示例13: savePluginFile

G::mk_dir($pathPublic);
G::mk_dir($pathPublic . 'images');
//  file_put_contents ( PATH_DATA . 'skins' . PATH_SEP . $id  , "hello world" );
$fields['className'] = $id;
$fields['version'] = $oConf->version;
$fields['description'] = $oConf->description;
$fields['PMversion'] = System::getVersion();
savePluginFile('skinPluginMainClass', $pathHome . $id . '.php', $fields);
savePluginFile('skinPluginClass', $pathBase . 'class.' . $id . '.php', $fields);
copyFile(PATH_SKINS . $id . '.php', $pathBase . 'data');
copyFile(PATH_SKINS . $id . '.html', $pathBase . 'data');
copyFile(PATH_SKINS . $id . '.cnf', $pathBase . 'data');
copyFile(PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'iepngfix.htc', $pathPublic);
copyFile(PATH_HTML . 'skins' . PATH_SEP . $id . PATH_SEP . 'style.css', $pathPublic);
$aFiles = array();
if ($handle = opendir($pathImages)) {
    while (false !== ($file = readdir($handle))) {
        if (substr($file, 0, 1) != '.') {
            if (isset($aFiles[$file])) {
                $aFiles[$file] = 0;
            }
            copyFile($pathImages . $file, $pathPublic . 'images' . PATH_SEP);
        }
    }
    closedir($handle);
}
$fileTar = packPlugin($id, $oConf->version);
$bDownload = true;
G::streamFile($fileTar, $bDownload, basename($fileTar));
@G::rm_dir($pathHome);
@unlink($fileTar);
开发者ID:nshong,项目名称:processmaker,代码行数:31,代码来源:skinsExport.php

示例14: restore

 /**
  * restore an archive into a workspace
  *
  * Restores any database and files included in the backup, either as a new
  * workspace, or overwriting a previous one
  *
  * @param string $filename the backup filename
  * @param string $newWorkspaceName if defined, supplies the name for the
  * workspace to restore to
  */
 public static function restore($filename, $srcWorkspace, $dstWorkspace = null, $overwrite = true, $lang = 'en')
 {
     G::LoadThirdParty('pear/Archive', 'Tar');
     $backup = new Archive_Tar($filename);
     //Get a temporary directory in the upgrade directory
     $tempDirectory = PATH_DATA . "upgrade/" . basename(tempnam(__FILE__, ''));
     $parentDirectory = PATH_DATA . "upgrade";
     if (is_writable($parentDirectory)) {
         mkdir($tempDirectory);
     } else {
         throw new Exception("Could not create directory:" . $parentDirectory);
     }
     //Extract all backup files, including database scripts and workspace files
     if (!$backup->extract($tempDirectory)) {
         throw new Exception("Could not extract backup");
     }
     //Search for metafiles in the new standard (the old standard would contain
     //txt files).
     $metaFiles = glob($tempDirectory . "/*.meta");
     if (empty($metaFiles)) {
         $metaFiles = glob($tempDirectory . "/*.txt");
         if (!empty($metaFiles)) {
             return workspaceTools::restoreLegacy($tempDirectory);
         } else {
             throw new Exception("No metadata found in backup");
         }
     } else {
         CLI::logging("Found " . count($metaFiles) . " workspaces in backup:\n");
         foreach ($metaFiles as $metafile) {
             CLI::logging("-> " . basename($metafile) . "\n");
         }
     }
     if (count($metaFiles) > 1 && !isset($srcWorkspace)) {
         throw new Exception("Multiple workspaces in backup but no workspace specified to restore");
     }
     if (isset($srcWorkspace) && !in_array("{$srcWorkspace}.meta", array_map(BASENAME, $metaFiles))) {
         throw new Exception("Workspace {$srcWorkspace} not found in backup");
     }
     $version = System::getVersion();
     $version = explode('-', $version);
     $versionPresent = isset($version[0]) ? $version[0] : '';
     CLI::logging(CLI::warning("\n            Note.- If you try to execute a restore from a generated backup on a recent version of Processmaker\n            than version you are using currently to restore it, it may be occur errors on the restore process,\n            it shouldn't be restaured generated backups on later versions than version when the restore is executed") . "\n");
     foreach ($metaFiles as $metaFile) {
         $metadata = G::json_decode(file_get_contents($metaFile));
         if ($metadata->version != 1) {
             throw new Exception("Backup version {$metadata->version} not supported");
         }
         $backupWorkspace = $metadata->WORKSPACE_NAME;
         if (isset($dstWorkspace)) {
             $workspaceName = $dstWorkspace;
             $createWorkspace = true;
         } else {
             $workspaceName = $metadata->WORKSPACE_NAME;
             $createWorkspace = false;
         }
         if (isset($srcWorkspace) && strcmp($metadata->WORKSPACE_NAME, $srcWorkspace) != 0) {
             CLI::logging(CLI::warning("> Workspace {$backupWorkspace} found, but not restoring.") . "\n");
             continue;
         } else {
             CLI::logging("> Restoring " . CLI::info($backupWorkspace) . " to " . CLI::info($workspaceName) . "\n");
         }
         $workspace = new workspaceTools($workspaceName);
         if ($workspace->workspaceExists()) {
             if ($overwrite) {
                 CLI::logging(CLI::warning("> Workspace {$workspaceName} already exist, overwriting!") . "\n");
             } else {
                 throw new Exception("Destination workspace already exist (use -o to overwrite)");
             }
         }
         if (file_exists($workspace->path)) {
             G::rm_dir($workspace->path);
         }
         foreach ($metadata->directories as $dir) {
             CLI::logging("+> Restoring directory '{$dir}'\n");
             if (file_exists("{$tempDirectory}/{$dir}" . "/ee")) {
                 G::rm_dir("{$tempDirectory}/{$dir}" . "/ee");
             }
             if (file_exists("{$tempDirectory}/{$dir}" . "/plugin.singleton")) {
                 G::rm_dir("{$tempDirectory}/{$dir}" . "/plugin.singleton");
             }
             if (!rename("{$tempDirectory}/{$dir}", $workspace->path)) {
                 throw new Exception("There was an error copying the backup files ({$tempDirectory}/{$dir}) to the workspace directory {$workspace->path}.");
             }
         }
         CLI::logging("> Changing file permissions\n");
         $shared_stat = stat(PATH_DATA);
         if ($shared_stat !== false) {
             workspaceTools::dirPerms($workspace->path, $shared_stat['uid'], $shared_stat['gid'], $shared_stat['mode']);
         } else {
             CLI::logging(CLI::error("Could not get the shared folder permissions, not changing workspace permissions") . "\n");
//.........这里部分代码省略.........
开发者ID:bqevin,项目名称:processmaker,代码行数:101,代码来源:class.wsTools.php

示例15: unset

    for ($i = 1; $i <= count($argv) - 1; $i++) {
        if (strpos($argv[$i], "+force") !== false) {
            $force = true;
            unset($argv[$i]);
            break;
        }
    }
    if (!$force) {
        $arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
        $bCronIsRunning = (bool) $arrayCron["bCronIsRunning"];
        $sLastExecution = $arrayCron["sLastExecution"];
        $processcTimeProcess = isset($arrayCron["processcTimeProcess"]) ? intval($arrayCron["processcTimeProcess"]) : 10;
        //Minutes
        $processcTimeStart = isset($arrayCron["processcTimeStart"]) ? $arrayCron["processcTimeStart"] : 0;
    } else {
        G::rm_dir(PATH_DATA . "cron");
    }
}
if ($bCronIsRunning && $processcTimeStart != 0) {
    if (time() - $processcTimeStart > $processcTimeProcess * 60) {
        //Cron finished his execution for some reason
        $bCronIsRunning = false;
    }
}
if (!$bCronIsRunning) {
    //Start cron
    $arrayCron = array("bCronIsRunning" => "1", "sLastExecution" => date("Y-m-d H:i:s"));
    @file_put_contents(PATH_DATA . "cron", serialize($arrayCron));
    try {
        //Data
        $ws = null;
开发者ID:bqevin,项目名称:processmaker,代码行数:31,代码来源:cron.php


注:本文中的G::rm_dir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。