This repository has been archived on 2024-07-18. You can view files and clone it, but cannot push or open issues or pull requests.
lwb5/scripts/game/main/library/requestGenPlanets.inc

30 lines
709 B
PHP
Raw Normal View History

2016-01-10 11:01:49 +01:00
<?php
class main_requestGenPlanets {
function main_requestGenPlanets($lib) {
$this->lib = $lib;
$this->db = $this->lib->game->db;
}
function run($first, $amount) {
$dir = config::getParam('pgenreq');
$game = $this->lib->game->name;
if (!is_dir($dir)) {
$base = dirname($dir);
if (!(is_dir($base) && is_writable($base) && @mkdir($dir))) {
logText("main::requestGenPlanets($game,$first,$amount): unable to create directory '$dir'", LOG_WARNING);
return false;
}
}
$r = @touch("$dir/req-$game-$first-$amount");
if (!$r) {
logText("main::requestGenPlanets($game,$first,$amount): unable to create file 'req-$game-$first-$amount'", LOG_WARNING);
}
return $r;
}
}
?>