function getZendid() { $idZend = zend_get_id(); $banyakIdZend = count($idZend); if ($banyakIdZend > 1) { foreach ($idZend as $id => $n) { $idZendSelected = $idZend[0]; } } else { if ($banyakIdZend == 1) { $idZendSelected = $idZend; } else { $idZendSelected = null; } } return $idZendSelected; }
protected function execute(InputInterface $input, OutputInterface $output) { $args = $input->getArgument('args'); $command = isset($args[0]) ? $args[0] : ''; switch ($command) { case 'cleanplaybackcache': $output->writeln(_("Starting Cache cleanup")); $days = \FreePBX::Config()->get("CACHE_CLEANUP_DAYS"); $time = $days * 24 * 60 * 60; $path = \FreePBX::Config()->get("AMPPLAYBACK"); $path = trim($path); $user = \FreePBX::Config()->get("AMPASTERISKWEBUSER"); $formats = \FreePBX::Media()->getSupportedHTML5Formats(); if (empty($path) || $path == "/") { $output->writeln("<error>" . sprintf(_("Invalid path %s"), $path) . "</error>"); exit(1); } if (file_exists($path)) { foreach (new \DirectoryIterator($path) as $fileInfo) { if ($fileInfo->isDot()) { continue; } $info = posix_getpwuid($fileInfo->getOwner()); if ($info['name'] != $user) { continue; } $extension = pathinfo($fileInfo->getFilename(), PATHINFO_EXTENSION); if ($fileInfo->isFile() && in_array($extension, $formats) && time() - $fileInfo->getCTime() >= $time) { $output->writeln(sprintf(_("Removing file %s"), basename($fileInfo->getRealPath()))); unlink($fileInfo->getRealPath()); } } } $output->writeln(_("Finished cleaning up cache")); break; case 'signaturecheck': \module_functions::create()->getAllSignatures(false, true); break; case 'tablefix': if (posix_geteuid() != 0) { $output->writeln("<error>You need to be root to run this command</error>"); exit(1); } $process = new Process('mysqlcheck --repair --all-databases'); try { $output->writeln(_("Attempting to repair MySQL Tables this may take a while")); $process->mustRun(); $output->writeln(_("MySQL Tables Repaired")); } catch (ProcessFailedException $e) { $output->writeln(sprintf(_("MySQL table repair Failed: %s"), $e->getMessage())); } break; case "zendid": $output->writeln("==========================="); foreach (zend_get_id() as $id) { $output->writeln($id); } $output->writeln("==========================="); break; default: $output->writeln('Invalid argument'); break; } }
<? require_once('src/prepend.inc.php'); $display["version"] = CONFIG::$APP_REVISION; // // Determine hostid // if (function_exists("zend_get_id")) { $display["hostid"] = zend_get_id(); } else { $retval = @exec(CONFIG::$ZENDID_PATH, $output, $return_var); if ($return_var != 0) { $os = strtolower(php_uname("s")); if ($os == "freebsd") { $r = php_uname("r"); $major_version = substr($r, 0, 1); if ($major_version > 5) $major_version = 5; $zendid_filename = "zendid_{$os}{$major_version}x"; } else { if ($os == 'linux') { $tp = (php_uname("m") == 'i386') ? 32 : 64;