コード例 #1
0
ファイル: System.php プロジェクト: niieani/napkin
 public static function getCPUsWithHT()
 {
     //  echo "Detecting number of CPU cores: ";
     LogCLI::Message('Detecting number of CPU cores (counting HyperThreading)', 2, LogCLI::INFO);
     $cpuCoreNum = (int) trim(shell_exec("cat /proc/cpuinfo | grep \"core id\" | sort | wc -l"));
     LogCLI::MessageResult(LogCLI::BLUE . 'CPU cores' . LogCLI::RESET . ' = ' . LogCLI::YELLOW . $cpuCoreNum . LogCLI::RESET, 2, LogCLI::INFO);
     LogCLI::Result(LogCLI::INFO);
     return $cpuCoreNum;
 }
コード例 #2
0
ファイル: ArrayTools.php プロジェクト: niieani/napkin
 public static function TraverseTree(array &$paths, $lookFor = 'defaults')
 {
     LogCLI::Message('Traversing definition tree in search for: ' . LogCLI::YELLOW . $lookFor . LogCLI::RESET, 6);
     $matches = array();
     foreach (self::GetMultiDimentionalElements($paths) as $path) {
         //LogCLI::MessageResult('Element: '.LogCLI::BLUE.$path.LogCLI::RESET, 6, LogCLI::INFO);
         $pathElements = explode('/', $path);
         //$lastElement = end($pathElements);
         //if(stripos($path, $lookFor) !== FALSE)
         if (end($pathElements) == $lookFor) {
             LogCLI::MessageResult('Match found at: ' . LogCLI::BLUE . $path . LogCLI::RESET, 2, LogCLI::INFO);
             $matches[] = $path;
             /*
             this code is good, don't remove
             if(!is_object(self::accessArrayElementByPath($this->nginx, $fullpath)))
             {
                 $last = StringTools::ReturnLastBit($fullpath);
                 $fullpath = StringTools::DropLastBit($fullpath, 1);
                 $fullpath = StringTools::AddBit($fullpath, $this->foreignDefinitions[$last]);
                 LogCLI::MessageResult('Common config detected! Defined by: '.LogCLI::BLUE.$fullpath.LogCLI::RESET, 5, LogCLI::INFO);
             }
             */
         }
     }
     LogCLI::Result(LogCLI::INFO);
     if (!empty($matches)) {
         return $matches;
     } else {
         return false;
     }
 }