/** * Perform various environment checks/initializations on wp_loaded * * @since 1.8 */ function load() { global $wp_query; if (apply_filters('searchwp_debug', false)) { $wp_upload_dir = wp_upload_dir(); $debug = new SearchWPDebug(); $debug->init($wp_upload_dir['basedir']); } do_action('searchwp_log', ' '); do_action('searchwp_log', '========== INIT ' . $this->pid . ' ' . SEARCHWP_VERSION . ' =========='); do_action('searchwp_log', ' '); $this->prepare_endpoint(); // check for upgrade new SearchWPUpgrade($this->version); // ensure working database environment $this->check_database_environment(); // set the registered post types $this->postTypes = array_merge(array('post' => 'post', 'page' => 'page', 'attachment' => 'attachment'), get_post_types(array('exclude_from_search' => false, '_builtin' => false))); // devs can customize which post types are indexed, it doesn't make // sense to list post types that were excluded (or included (e.g. post types that don't // allow filtration of the exclude_from_search arg)) $this->postTypes = $this->get_indexed_post_types(); // if the settings were somehow edited directly in the database $this->settings = SWP()->validate_settings($this->settings); // allow filtration of what SearchWP considers common words (i.e. ignores) $this->common = apply_filters('searchwp_common_words', $this->common); $this->alternate_indexer = apply_filters('searchwp_alternate_indexer', false); // one-stop filter to ensure SearchWP fires if ($this->force_run = apply_filters('searchwp_force_run', $this->force_run)) { $wp_query->is_search = true; } $this->check_if_paused(); $this->set_index_update_triggers(); do_action('searchwp_load'); // handle index and/or purge requests $this->update_index(); // reset short circuit check $this->indexing = false; }
/** * Perform various environment checks/initializations on wp_loaded * * @since 1.8 */ function load() { global $wp_query; if (apply_filters('searchwp_debug', false)) { $debug = new SearchWPDebug(); $debug->init($this->dir); } do_action('searchwp_log', ' '); do_action('searchwp_log', '========== INIT ' . $this->pid . ' ' . SEARCHWP_VERSION . ' =========='); do_action('searchwp_log', ' '); // check for upgrade new SearchWPUpgrade($this->version); // ensure working database environment $this->checkDatabaseEnvironment(); // update remote debugging info if applicable $maybe_remote = searchwp_get_setting('remote'); if (!is_null($maybe_remote) && $maybe_remote) { add_action('shutdown', array($this, 'updateRemoteMeta')); } // set the registered post types $this->postTypes = array_merge(array('post' => 'post', 'page' => 'page', 'attachment' => 'attachment'), get_post_types(array('exclude_from_search' => false, '_builtin' => false))); // allow filtration of what SearchWP considers common words (i.e. ignores) $this->common = apply_filters('searchwp_common_words', $this->common); // one-stop filter to ensure SearchWP fires if ($this->force_run = apply_filters('searchwp_force_run', $this->force_run)) { $wp_query->is_search = true; } $this->checkIfPaused(); $this->set_index_update_triggers(); // implement registered Extensions $this->primeExtensions(); // handle index and/or purge requests $this->updateIndex(); // reset short circuit check $this->indexing = false; }