gdc() public static méthode

reads a directory and return the name of the files and directorys in it
public static gdc ( string $strPath, boolean $booErrorRep = true ) : array
$strPath string path of the directory which should be read
$booErrorRep boolean en- or disables the reporting of errors which should be logged
Résultat array content of the directory excluding . and ..
 /**
  * IDE devices
  *
  * @return void
  */
 private function _ide()
 {
     $bufd = CommonFunctions::gdc('/proc/ide', false);
     foreach ($bufd as $file) {
         if (preg_match('/^hd/', $file)) {
             $dev = new HWDevice();
             $dev->setName(trim($file));
             if (CommonFunctions::rfts("/proc/ide/" . $file . "/media", $buf, 1)) {
                 if (trim($buf) == 'disk') {
                     if (CommonFunctions::rfts("/proc/ide/" . $file . "/capacity", $buf, 1, 4096, false) || CommonFunctions::rfts("/sys/block/" . $file . "/size", $buf, 1, 4096, false)) {
                         $dev->setCapacity(trim($buf) * 512 / 1024);
                     }
                 }
             }
             if (CommonFunctions::rfts("/proc/ide/" . $file . "/model", $buf, 1)) {
                 $dev->setName($dev->getName() . ": " . trim($buf));
             }
             $this->sys->setIdeDevices($dev);
         }
     }
 }
 /**
  * get all available translations and store them in internal array
  *
  * @return void
  */
 private function _getLanguageList()
 {
     $dirlist = CommonFunctions::gdc(APP_ROOT . '/language/');
     sort($dirlist);
     foreach ($dirlist as $file) {
         $lang_ext = substr($file, strlen($file) - 4);
         $lang_name = substr($file, 0, strlen($file) - 4);
         if ($lang_ext == ".xml") {
             array_push($this->_languages, $lang_name);
         }
     }
 }
Exemple #3
0
    private function CronTime() {
        $crons = CommonFunctions::gdc('/etc/cron.d/');
        $file = '';

        foreach($crons as $cron) {
            $path = '/etc/cron.d/'.$cron;
            if(is_file($path) && $cron == 'lcse3-monitor') {
                $file = $path;
                break;
            }
        }

        if($file == '')
            return;

        if(CommonFunctions::rfts($file, $buffer)) {
            $lines = explode("\n",$buffer);
            foreach($lines as $line) {
                if(empty($line) || $line[0] == '#' || ereg("(.*)=(.*)", $line, $assign) || $line[0] == '@')
                    continue;
                else {
                    $data = explode(" ", $line, 7);
                    break;
                }
            }

            if($data == array())
                return;

            list($minute, $heure, $jour, $mois, $jourSemaine, $user, $cmd) = $data;

            $cron = new CronParser();
            $cron->calcNextRan(implode(" ", array($minute, $heure, $jour, $mois, $jourSemaine)));
            $stamp = $cron->getLastRanUnix();

            return '<NextUpdate unix="'.$stamp.'">'.date('r',$stamp).'</NextUpdate>';
        }
    }