wp_stateless_get_migrations

wp_stateless_get_migrations

Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wp-stateless.4.1.2

apply_filters('wp_stateless_get_migrations') is found 8 times:

  • /lib/classes/class-migrator.php line 154
       * @param array $migrations|null  
       */
      private function _check_required_migrations($migrations = null) {
        if ( empty($migrations) ) {
          $migrations = apply_filters('wp_stateless_get_migrations', []);
        }
    
        $require_migrations = false;
    
        foreach ($migrations as $id => $migration) {
          if ( !in_array( $migration['status'], [self::STATUS_FINISHED, self::STATUS_SKIPPED] ) ) {
    
  • /lib/classes/class-migrator.php line 196
      public function migrate() {
        // Rebuild the migrations list and state according to the new version
        $ids = $this->_get_migration_ids();
    
        $migrations = apply_filters('wp_stateless_get_migrations', []);
        $existing = array_keys($migrations);
    
        foreach ($ids as $id) {
          if ( in_array($id, $existing) ) {
            continue;
          }
    
  • /lib/classes/class-migrator.php line 279
       * @param string $class
       * @param string $file
       */
      public function migration_started($class, $file) {
        $migrations = apply_filters('wp_stateless_get_migrations', []);
        $id = $this->_file_to_id($file);
    
        if ( array_key_exists($id, $migrations) ) {
          $migrations[$id]['status'] = self::STATUS_RUNNING;
          $migrations[$id]['started'] = time();
          $migrations[$id]['finished'] = '';
    
  • /lib/classes/class-migrator.php line 299
       * @param string $file
       * @param string $message 
       */
      public function migration_failed($class, $file, $message) {
        $migrations = apply_filters('wp_stateless_get_migrations', []);
        $id = $this->_file_to_id($file);
    
        if ( array_key_exists($id, $migrations) ) {
          $migrations[$id]['status'] = self::STATUS_FAILED;
          $migrations[$id]['message'] = $message;
    
    
  • /lib/classes/class-migrator.php line 317
       *
       * @param string $class
       */
      public function migration_finished($class, $state) {
        $migrations = apply_filters('wp_stateless_get_migrations', []);
        $id = $this->_class_to_id($class);
    
        if ( array_key_exists($id, $migrations) ) {
          $migrations[$id]['status'] = self::STATUS_FINISHED;
          $migrations[$id]['finished'] = time();
    
    
  • /lib/classes/class-migrator.php line 368
          return $state;
        }
    
        $id = $params['id'];
        $migrations = apply_filters('wp_stateless_get_migrations', []);
    
        // Unknown migration?
        if ( !array_key_exists($id, $migrations) ) {
          return $state;
        }
    
    
  • /lib/classes/status/class-migrations.php line 180
       * @return array
       */
      private function _get_migrations_state($state = null) {
        $migrations = [];
        $this->migrations = apply_filters('wp_stateless_get_migrations', []);
    
        if ( !is_array($this->migrations) ) {
          $this->migrations = [];
        }
    
        $defaults = [
    
  • /lib/cli/class-sm-cli-command.php line 335
          $progress = $assoc_args['progress'] ?? 1;
    
          do {
            // We need to omit the cache and get the data directly from the db
            $migrations = apply_filters('wp_stateless_get_migrations', []);
    
            $keys = array_reverse( array_keys($migrations) );
            $id = null;
    
            // Do we have next pending migration?
            foreach ($keys as $key) {
    

See this hook used in plugins: