Ejemplo n.º 1
0
            $profName = $fname . '-extensions-' . get_class($func[0]) . '::' . $func[1];
        } else {
            $profName = $fname . '-extensions-' . implode('::', $func);
        }
    } else {
        $profName = $fname . '-extensions-' . strval($func);
    }
    $ps_ext_func = Profiler::instance()->scopedProfileIn($profName);
    call_user_func($func);
    Profiler::instance()->scopedProfileOut($ps_ext_func);
}
// If the session user has a 0 id but a valid name, that means we need to
// autocreate it.
if (!defined('MW_NO_SESSION') && !$wgCommandLineMode) {
    $sessionUser = MediaWiki\Session\SessionManager::getGlobalSession()->getUser();
    if ($sessionUser->getId() === 0 && User::isValidUserName($sessionUser->getName())) {
        $ps_autocreate = Profiler::instance()->scopedProfileIn($fname . '-autocreate');
        $res = MediaWiki\Auth\AuthManager::singleton()->autoCreateUser($sessionUser, MediaWiki\Auth\AuthManager::AUTOCREATE_SOURCE_SESSION, true);
        Profiler::instance()->scopedProfileOut($ps_autocreate);
        \MediaWiki\Logger\LoggerFactory::getInstance('authevents')->info('Autocreation attempt', ['event' => 'autocreate', 'status' => $res]);
        unset($res);
    }
    unset($sessionUser);
}
if (!$wgCommandLineMode) {
    Pingback::schedulePingback();
}
wfDebug("Fully initialised\n");
$wgFullyInitialised = true;
Profiler::instance()->scopedProfileOut($ps_extensions);
Profiler::instance()->scopedProfileOut($ps_setup);
Ejemplo n.º 2
0
            $rss_items[$i]['pubdate'] = gmdate('r', $comment['time']);
            $i++;
        }
    }
    if (isset($rss_items)) {
        $template->assign('rss_items', $rss_items);
    }
    $content_type = 'text/xml';
    $template_file = 'rss.tpl';
    $template_done = true;
} elseif (isset($_GET['get_1']) && $_GET['get_1'] == 'pingback' && $settings['pingbacks_enabled'] && empty($data['type_addition'])) {
    // disable caching:
    if ($settings['caching']) {
        $cache->doCaching = false;
    }
    $pingback = new Pingback();
    $pingback->pingback_title_maxlength = $settings['pingback_title_maxlength'];
    $pingback->settings = $settings;
    if ($pingback->get_pingback($data['id'])) {
        if (isset($cache)) {
            $cache->clear(PAGE);
            $cache->clearRelated(PAGE);
        }
        exit;
    } else {
        exit;
    }
} elseif (isset($_POST['preview'])) {
    if ($preview = $comment->preview()) {
        $template->assign('preview', $preview);
    }
Ejemplo n.º 3
0
 /**
  * Schedule a deferred callable that will check if a pingback should be
  * sent and (if so) proceed to send it.
  */
 public static function schedulePingback()
 {
     DeferredUpdates::addCallableUpdate(function () {
         $instance = new Pingback();
         if ($instance->shouldSend()) {
             $instance->sendPingback();
         }
     });
 }
Ejemplo n.º 4
0
         $dbr->bindParam(':edit_permission_general', $_POST['edit_permission_general'], PDO::PARAM_INT);
         $dbr->bindParam(':tv', $_POST['tv'], PDO::PARAM_STR);
         $dbr->bindParam(':status', $_POST['status'], PDO::PARAM_INT);
         $dbr->bindParam(':author', $_SESSION[$settings['session_prefix'] . 'user_id'], PDO::PARAM_INT);
         $dbr->execute();
     }
     if (isset($cache) && $cache->autoClear) {
         $cache->clear();
     }
     if ($settings['pingbacks_enabled'] && $send_pingbacks) {
         $page_content = $_POST['content'];
         if ($settings['content_auto_link'] == 1) {
             $page_content = make_link($page_content);
         }
         $page_content = parse_special_tags($page_content);
         $pingback = new Pingback();
         $pingback->ping(BASE_URL . $_POST['page'], $page_content);
     }
     if (intval($_POST['status']) == 0) {
         header('Location: ' . BASE_URL . ADMIN_DIR . 'index.php?mode=pages');
         exit;
     } else {
         header('Location: ' . BASE_URL . $_POST['page']);
     }
 } else {
     $template->assign('errors', $errors);
     if (isset($_POST['id'])) {
         $page_data['id'] = intval($_POST['id']);
     }
     $page_data['edit_mode'] = isset($_POST['edit_mode']) ? intval($_POST['edit_mode']) : 0;
     $page_data['page'] = isset($_POST['page']) ? htmlspecialchars($_POST['page']) : '';