case 'modify': // if($argc == 5) echo "Modifying\n"; // { $config = YAML::load($args[1]); $config[$args[2]][$args[3]] = $args[4]; var_dump($config); toFile($config, $filename); // } break; case 'modifySite': echo "Modifying site\n"; $config = YAML::load($args[1]); $config['nginx.sites'][$args[2]][$args[3]] = $args[4]; var_dump($config); toFile($config, $filename); break; case 'generateAll': // $result = process_dir($args[1],TRUE); $yamls = getAllYaml($args[1]); // Output each opened file and then close /* foreach ($result as $file) { if (is_resource($file['handle'])) { echo "\n\nFILE (" . $file['dirpath'].'/'.$file['filename'] . "):\n\n" . fread($file['handle'], filesize($file['dirpath'].'/'.$file['filename'])); fclose($file['handle']); } }*/ //var_dump($yamls); foreach ($yamls as $yaml) { echo "\nGenerating from {$yaml}:\n"; $config = YAML::load($yaml);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); // Return Page contents. $result = curl_exec($ch); // grab URL and pass it to the variable. curl_close($ch); // close curl resource, and free up system resources. $result_arr = array(); $plain = strip_tags($result, "<td>"); //check if student_id exits if (strpos($plain, 'Không tìm thấy mã số sinh viên này trong dữ liệu')) { $result = ''; return; } $sinhvien = explode('Sinh viên :', $plain); $sinhvien = explode('-Mssv:', $sinhvien[1]); $result_arr[0] = $sinhvien[0]; $temp_hks = explode('BẢNG ĐIỂM HK', $sinhvien[1]); $count = count($temp_hks); for ($i = 1; $i < $count; $i++) { $result_arr[$i] = parseHK($temp_hks[$i], $sid); } return $result_arr; } include_once 'toFile.php'; $id = $_REQUEST['msv']; $fn = $_REQUEST['fn']; $bd = $_REQUEST['birthday']; $result = getMarkByID($id); toFile($result, $id, $bd, $fn); ?>
function printAll($lastarticles, $language) { $statisticdir = Options::getOption('statisticdir'); Timer::start('main::glob'); if (Options::getOption('noglob')) { Statistics::setArticleQueue('deactivated for speed'); } else { Statistics::setArticleQueue(count(glob(Options::getOption('oaiRecords') . "/*.*"))); } Timer::stop('main::glob'); /* * //too slow Timer::start('main::lswc'); Statistics::setArticleQueue(exec ('ls -1 '.Options::getOption('oaiRecords').' | wc -l')); Timer::stop('main::lswc'); */ $data = array(); $data['lastarticles'] = $lastarticles; Timer::stop("main::Runtime"); $timeString = Timer::getTimeAsString(); $data['timeString'] = $timeString; $data['time'] = Timer::$time; Timer::start("main::Runtime"); $overall = array(); $overall['startingtime'] = Timer::$startingTime; $overall['lasttime'] = microtime(true); $data['timeOverall'] = $overall; Timer::stop("main::processing"); $data['processingTime'] = Timer::$time["main::processing"]['total']; Timer::start("main::processing"); //toFile($time, 'timeString.txt', $statisticdir); //do statistics //Timer::timeToFile($statisticdir); // Statistics::statisticsToFile($statisticdir); $data['triples'] = Statistics::$countArr; $data['extractorMeta'] = Statistics::$extractorMeta; $s = Timer::getElapsedSeconds(); $t = Statistics::getTotalTriples(); $memory = "memory_get_usage (true ): " . memory_get_usage(true) . "\n"; $memory .= "memory_get_usage (false ): " . memory_get_usage(false) . "\n"; $memory .= "memory_get_peak_usage (true ): " . memory_get_peak_usage(true) . "\n"; $memory .= "memory_get_peak_usage (false ): " . memory_get_peak_usage(false) . "\n"; $data['memory'] = $memory; //toFile($memory, 'memory.txt', $statisticdir); //echo $s."\n"; $general = "Seconds per article: " . $s / Statistics::getTotalArticles() . "\n"; $general .= "Articles per second: " . Statistics::getTotalArticles() / $s . "\n"; $general .= "Articles per hour: " . Statistics::getTotalArticles() / $s * 3600 . "\n"; $general .= "Category per second: " . Statistics::getTotalCategories() / $s . "\n"; $general .= "Category per hour: " . Statistics::getTotalCategories() / $s * 3600 . "\n"; $general .= "Redirect per second: " . Statistics::getTotalRedirects() / $s . "\n"; $general .= "Redirect per hour: " . Statistics::getTotalRedirects() / $s * 3600 . "\n"; $general .= "Triples per second: " . $t / $s . "\n"; $general .= "Triples per minute: " . $t / $s * 60 . "\n"; $general .= "Triples per hour: " . $t / $s * 3600 . "\n"; $general .= "Triples per day: " . $t / $s * 3600 * 24 . "\n"; $data['general'] = $general; $append = ''; if (Options::isOptionSet('processID')) { $append = Options::$config['processID']; } $indexfile = 'index' . $append . '.html'; toFile(Statistics::generateStatisticHTML(Options::getOption('linkeddataresourceprefix'), $language, $data), $indexfile, $statisticdir); Logger::info('wrote html file to ' . $statisticdir . '/' . $indexfile); }
toFile("CREATE TABLE pages (page_id integer(2), website_id integer(2), page_slug varchar(100), page_name varchar(100), page_last_revised datetime, page_parent integer(2), page_order integer(2)); \n"); for ($i = 1; $i <= $no_pages; $i++) { $website_id = rand(1, $no_websites); $page_parent = rand(1, $no_pages); $page_name = implode(" ", $faker->words(rand(3, 8))); $page_order = rand(1, 4); $pages = "INSERT INTO pages VALUES ({$i}, {$website_id}, \"{$faker->slug}\" ,\"{$page_name}\", CURRENT_TIMESTAMP, {$page_parent}, {$page_order}); \n"; toFile($pages); } // create content table // content_id, content_version, user_id, content_date, content toFile("CREATE TABLE content (content_id integer(2), content_version float(2), user_id integer(2), content_date datetime, content text); \n"); for ($i = 0; $i <= $no_content; $i++) { $content_version = rand(0, 100) / 10; $user_id = rand(1, $no_users); $content = "INSERT INTO content VALUES ({$i}, {$content_version}, {$user_id}, CURRENT_TIMESTAMP, \"{$faker->text}\"); \n"; toFile($content); } // create settings table // setting_id, website_id, setting, setting_value toFile("CREATE TABLE settings (setting_id integer(2), website_id integer(2), setting varchar(50), setting_value varchar(50)); \n"); for ($i = 1; $i <= $no_websites * 2; $i++) { $website_id = ceil($i / 2); $options = ['image_height', 'image_width']; $options_value = ['400', '300']; $options = $i % 2 == 0 ? $options[0] : $options[1]; $options_value = $i % 2 == 0 ? $options_value[0] : $options_value[1]; $settings = "INSERT INTO settings VALUES ({$i}, {$website_id}, \"{$options}\" ,\"{$options_value}\"); \n"; toFile($settings); } echo "File successfully made \n";