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


PHP Configurations::setDirectoryStructureVer方法代码示例

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


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

示例1: upgradeCasesDirectoryStructure


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

                    } else {

                        CLI::logging(CLI::error("Error: Failure at coping from $UIdDir...\n"));

                    }

                } else {

                    CLI::logging("$UIdDir is empty, removing it\n");

                    rmdir($UIdDir);//remove the diretory itself

                }

            }

        }



        //Start '0' directory migration

        $black = PATH_DOCUMENT . $blackHoleDir . '/';

        if (is_dir($black)) {

            $newpattern = array();

            $file = glob($black . '*.*');//files only

            $dirlen = count($file);



            for ($index = 0; $index < $dirlen; $index++) {

                $levelfile = explode('/', $file[$index]);

                $lastlevel = sizeof($levelfile);

                $goalFile = $levelfile[$lastlevel - 1];

                $newpattern = G::getPathFromFileUIDPlain($blackHoleDir, $goalFile);

                CLI::logging("Migrating $blackHoleDir file: $goalFile\n");

                G::mk_dir($blackHoleDir . PATH_SEP . $newpattern[0], 0777);

                //echo `cp -R $black$goalFile $black$newpattern[0]/$newpattern[1]`;



                if (copy($black . $goalFile, $black . $newpattern[0] . '/' . $newpattern[1])) {

                    unlink($file[$index]);

                } else {

                    CLI::logging(CLI::error("Error: Failure at copy $file[$index] files...\n"));

                }

            }

        }



        //Set value of 2 to the directory structure version.

        $this->initPropel(true);

        G::LoadClass("configuration");

        $conf = new Configurations();

        if (!$conf->exists("ENVIRONMENT_SETTINGS")) {

            $conf->aConfig = array ("format" => '@userName (@firstName @lastName)',

                                "dateFormat" => 'd/m/Y',

                                "startCaseHideProcessInf" => false,

                                "casesListDateFormat" => 'Y-m-d H:i:s',

                                "casesListRowNumber" => 25,

                                "casesListRefreshTime" => 120 );

            $conf->saveConfig( 'ENVIRONMENT_SETTINGS', '' );

        }

        $conf->setDirectoryStructureVer(2);

        CLI::logging(CLI::info("Version Directory Structure is 2 now.\n"));

    }
开发者ID:rrsc,项目名称:processmaker,代码行数:101,代码来源:class.wsTools.php

示例2: upgradeCasesDirectoryStructure

 /**
  * fix the 32K issue, by migrating /files directory structure to an uid tree structure based.
  * @param $workspace got the site(s) the manager wants to upgrade
  */
 public function upgradeCasesDirectoryStructure($workspace)
 {
     define('PATH_DOCUMENT', PATH_DATA . 'sites/' . $workspace . '/' . 'files/');
     $doclevel = explode('/', PATH_DOCUMENT);
     $length = sizeof(PATH_DOCUMENT);
     $filesDir = $doclevel[$length - 1];
     if (is_dir(PATH_DOCUMENT) && is_writable($filesDir)) {
         CLI::logging(CLI::error("Error:" . PATH_DOCUMENT . " is not writable... please check the su permissions.\n"));
         return;
     }
     $directory = array();
     $blackHoleDir = G::getBlackHoleDir();
     $directory = glob(PATH_DOCUMENT . "*", GLOB_ONLYDIR);
     $dirslength = sizeof($directory);
     if (!@chdir(PATH_DOCUMENT)) {
         CLI::logging(CLI::error("Cannot use Document directory. The upgrade must be done as root.\n"));
         return;
     }
     //Start migration
     for ($index = 0; $index < $dirslength; $index++) {
         $depthdirlevel = explode('/', $directory[$index]);
         $lastlength = sizeof($depthdirlevel);
         $UIdDir = $depthdirlevel[$lastlength - 1];
         $lenDir = strlen($UIdDir);
         if ($lenDir == 32 && $UIdDir != $blackHoleDir) {
             $len = count(scandir($UIdDir));
             if ($len > 2) {
                 //lenght = 2, because the function check . and .. dir links
                 $newDiretory = G::getPathFromUIDPlain($UIdDir);
                 CLI::logging("Migrating {$UIdDir} to {$newDiretory}\n");
                 G::mk_dir($newDiretory);
                 //echo `cp -R $UIdDir/* $newDiretory/`;
                 if (G::recursive_copy($UIdDir, $newDiretory)) {
                     CLI::logging("Removing {$UIdDir}...\n");
                     G::rm_dir($UIdDir);
                     rmdir($UIdDir);
                     //remove the diretory itself, G::rm_dir cannot do it
                 } else {
                     CLI::logging(CLI::error("Error: Failure at coping from {$UIdDir}...\n"));
                 }
             } else {
                 CLI::logging("{$UIdDir} is empty, removing it\n");
                 rmdir($UIdDir);
                 //remove the diretory itself
             }
         }
     }
     //Start '0' directory migration
     $black = PATH_DOCUMENT . $blackHoleDir . '/';
     if (is_dir($black)) {
         $newpattern = array();
         $file = glob($black . '*.*');
         //files only
         $dirlen = count($file);
         for ($index = 0; $index < $dirlen; $index++) {
             $levelfile = explode('/', $file[$index]);
             $lastlevel = sizeof($levelfile);
             $goalFile = $levelfile[$lastlevel - 1];
             $newpattern = G::getPathFromFileUIDPlain($blackHoleDir, $goalFile);
             CLI::logging("Migrating {$blackHoleDir} file: {$goalFile}\n");
             G::mk_dir($blackHoleDir . '/' . $newpattern[0]);
             //echo `cp -R $black$goalFile $black$newpattern[0]/$newpattern[1]`;
             if (copy($black . $goalFile, $black . $newpattern[0] . '/' . $newpattern[1])) {
                 unlink($file[$index]);
             } else {
                 CLI::logging(CLI::error("Error: Failure at copy {$file[$index]} files...\n"));
             }
         }
     }
     //Set value of 2 to the directory structure version.
     $this->initPropel(true);
     G::LoadClass("configuration");
     $conf = new Configurations();
     if ($conf->exists("ENVIRONMENT_SETTINGS")) {
         $conf->setDirectoryStructureVer(2);
         CLI::logging(CLI::info("Version Directory Structure is 2 now.\n"));
     } else {
         CLI::logging(CLI::error("Error: found at try to use ENVIRONMENT_SETTINGS row.\n"));
         return;
     }
 }
开发者ID:ralpheav,项目名称:processmaker,代码行数:85,代码来源:class.wsTools.php


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