Двойная проверка перед созданием страниц на вики
This commit is contained in:
parent
90cfb5ca72
commit
2e68a2e624
|
@ -39,7 +39,7 @@ class Wikipage {
|
|||
public function __construct($game) {
|
||||
$this->game = $game;
|
||||
|
||||
if (!env('APP_DEBUG')) {
|
||||
if (!env('APP_DEBUG') && !empty(env('WIKI'))) {
|
||||
try {
|
||||
// Log in to a wiki
|
||||
$api = new MediawikiApi( env('WIKI') );
|
||||
|
@ -65,6 +65,10 @@ class Wikipage {
|
|||
}
|
||||
|
||||
public function create() {
|
||||
if (env('APP_DEBUG') || empty(env('WIKI'))) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!empty($this->game->image_url)) {
|
||||
$filename = preg_replace('/\?.*/', '', basename($this->game->image_url));
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
|
@ -201,7 +205,7 @@ class Wikipage {
|
|||
* @return boolean
|
||||
*/
|
||||
protected function exists($pagename) {
|
||||
if (env('APP_DEBUG')) {
|
||||
if (env('APP_DEBUG') || empty(env('WIKI'))) {
|
||||
return false;
|
||||
}
|
||||
$page = $this->services->newPageGetter()->getFromTitle((string) $pagename);
|
||||
|
|
Loading…
Reference in a new issue