You are here

class PrefixHandler in DB Maintenance 7.2

Same name and namespace in other branches
  1. 8 src/Module/Db/PrefixHandler.php \Drupal\db_maintenance\Module\Db\PrefixHandler
  2. 2.0.x src/Module/Db/PrefixHandler.php \Drupal\db_maintenance\Module\Db\PrefixHandler

PrefixHandler class.

Hierarchy

Expanded class hierarchy of PrefixHandler

File

src/Module/Db/PrefixHandler.php, line 14
PrefixHandler class.

Namespace

Drupal\db_maintenance\Module\Db
View source
class PrefixHandler {

  /**
   * Returns table prefix.
   */
  public static function getPrefix($table) {
    $px = \Database::getConnection()
      ->tablePrefix($table);

    // watchdog('db_maintenance', 'Prefix of @table is @px .',
    //   array('@px' => $px, '@table' => $table), WATCHDOG_DEBUG);
    return $px;
  }

  /**
   * Cleans table prefix.
   */
  public static function clearPrefix($table) {
    $px = self::getPrefix($table);
    if (strlen($px) > 0) {
      $table_clear = str_replace($px, '', $table);
      return $table_clear;
    }
    return $table;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
PrefixHandler::clearPrefix public static function Cleans table prefix.
PrefixHandler::getPrefix public static function Returns table prefix.