Numerous fixes following the code review:
H1 title should be "Welcome to MailPoet version 3!", as per wireframes remove logo in top right of the page remove the classes feature-section one-col to the parent new styles for #logger progress bar: ensure that the color and size for the font are the same as our current progress bar. display the progress bar at 100% when the import of subscribers and lists is complete move loadSQL() function in tests/_support/Helper/Database.php remove CSS browser prefixes use AMD module definition to embed the JavaScript remove extra whitespace in JavaScript file remove the redundant functions descriptions rename objectPlugin to mailpoet_mp2_migrator replace private $chunks_size by the constant CHUNK_SIZE add the constant IMPORT_TIMEOUT_IN_SECONDS replace Helpers::mysqlDate() by $datetime->formatTime(time(), \MailPoet\WP\DateTime::DEFAULT_DATE_TIME_FORMAT) make the log messages translatable fix PHPDoc replace Env::$plugin_name by 'mailpoet' in the translation functions use $snake_case for variable names, use lowercaseCamelCase for method names, use CamelCase for class names define MP2 table names as constants add spaces around ternary operators use the models for MP3 entities, instead of counting via raw SQL queries use \ORM::for_table('some_table')::count()
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
namespace MailPoet\Util;
|
||||
use MailPoet\Config\Env;
|
||||
|
||||
class Helpers {
|
||||
const DIVIDER = '***MailPoet***';
|
||||
@@ -138,47 +137,4 @@ class Helpers {
|
||||
return explode(self::DIVIDER, $object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a timestamp to a Mysql datetime
|
||||
*
|
||||
* @param int $timestamp Timestamp
|
||||
* @return string Datetime
|
||||
*/
|
||||
static public function mysqlDate($timestamp) {
|
||||
return date('Y-m-d H:i:s', $timestamp);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count the number of rows in a table
|
||||
*
|
||||
* @global object $wpdb
|
||||
* @param string $table Table
|
||||
* @param bool $withoutPrefix Table name without DB prefix
|
||||
* @return int Number of rows found
|
||||
*/
|
||||
static public function rowsCount($table, $withoutPrefix=true) {
|
||||
global $wpdb;
|
||||
|
||||
if($withoutPrefix) {
|
||||
$table = $wpdb->prefix . $table;
|
||||
}
|
||||
$sql = "SELECT COUNT(*) FROM `$table`";
|
||||
$count = $wpdb->get_var($sql);
|
||||
|
||||
return $count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a SQL file
|
||||
*
|
||||
* @param string $filename Filename without extension
|
||||
*/
|
||||
static public function loadSQL($filename) {
|
||||
$db = \ORM::getDb();
|
||||
$full_filename = Env::$path . '/tests/_data/' . $filename . '.sql';
|
||||
$sql = file_get_contents($full_filename);
|
||||
$db->exec($sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user