echo 'done'; } echo "\n"; echo "\n" . 'Checking Pandoc... '; $pandoc_ver = get_pandoc_version(); if ($pandoc_ver === false) { echo 'Not installed' . "\n"; } else { echo $pandoc_ver . "\n"; } echo "\n" . 'Checking content dir... '; if (check_content_dir()) { echo 'done' . "\n"; } else { echo 'failed. Make sure the webserver process can write to ' . config('content_dir') . '.' . "\n"; } echo "\n" . 'Checking cache health... '; if (check_cache_lru()) { echo 'done' . "\n"; } else { echo 'failed. Some files in ' . config('content_dir') . '/cache might not be removable by the webserver process.' . "\n"; } echo "\n" . 'Checking tmp dir health... '; if (check_tmp_dir_age()) { echo 'done' . "\n"; } else { echo 'failed. Some files in ' . config('content_dir') . '/tmp might not be removable by the webserver process.' . "\n"; } echo "\n" . 'Checking available disk space... '; echo disk_free_space(tmp_dir('')) . ' bytes' . "\n"; echo "\n" . 'All done.';
/** * Get a private copy of a remote Git repository * * The private copy can be manipulated with the returned tmp key. Call * release_repo() after it is no longer needed. * @param $url Git (clone) URL * @param $branch branch to check out (default is "master") * @param $force_update force a fetch * @return tmp key, or false if unsuccessful */ function get_repo($url, $branch = 'master', $force_update = false) { $tmp_key = tmp_key(); // get a cached copy, currently on the master branch $cache_key = get_repo_for_reading($url, $force_update); if ($cache_key === false) { return false; } // create files and directories as permissive as possible $old_umask = @umask(00); // copy to tmp if (false === cp_recursive(cache_dir($cache_key), tmp_dir($tmp_key))) { // copying failed, remove again rm_recursive(tmp_dir($tmp_key)); @umask($old_umask); return false; } if ($branch === 'master') { // XXX (later): revisit & document - IIRC the reason for this was that // same of the permissions were off after a regular copy (w/ umask) and // that running the git command somehow fix them? $ret = repo_cleanup($tmp_key); } else { $ret = repo_checkout_branch($tmp_key, $branch); // XXX (later): revisit - does this also need repo_cleanup()? } @umask($old_umask); if ($ret === false) { // copying failed, remove again rm_recursive(tmp_dir($tmp_key)); return false; } // XXX (later): this could be done asynchronously check_tmp_dir_age(); return $tmp_key; }