Bläddra i källkod

Show a warning message in the admin panel when MyISAM is still in use

tags/3.5.1
Tobias Diekershoff 4 år sedan
förälder
incheckning
7aaaa0a3c7
4 ändrade filer med 28 tillägg och 1 borttagningar
  1. +11
    -1
      mod/admin.php
  2. +4
    -0
      util/convert_innodb.sql
  3. +8
    -0
      view/global.css
  4. +5
    -0
      view/templates/admin_summary.tpl

+ 11
- 1
mod/admin.php Visa fil

@@ -428,6 +428,14 @@ function admin_page_queue(&$a) {
* @return string
*/
function admin_page_summary(&$a) {
// are there MyISAM tables in the DB? If so, trigger a warning message
$r = q("select `engine` from `information_schema`.`tables` where `engine`='myisam' limit 1");
$showwarning = false;
$warningtext = "";
if (dbm::is_result($r)) {
$showwarning = true;
$warningtext = sprintf(t('Your DB still runs with MyISAM tables. You should change the engine type to InnoDB. As Friendica will use InnoDB only features in the future, you should change this! See <a href="%s">here</a> for a guide that may be helpful converting the table engines. You may also use the <tt>convert_innodb.sql</tt> in the <tt>/util</tt> directory of your Friendica installation.<br />'), 'https://dev.mysql.com/doc/refman/5.7/en/converting-tables-to-innodb.html');
}
$r = q("SELECT `page-flags`, COUNT(`uid`) AS `count` FROM `user` GROUP BY `page-flags`");
$accounts = array(
array(t('Normal Account'), 0),
@@ -478,7 +486,9 @@ function admin_page_summary(&$a) {
'$platform' => FRIENDICA_PLATFORM,
'$codename' => FRIENDICA_CODENAME,
'$build' => get_config('system','build'),
'$plugins' => array(t('Active plugins'), $a->plugins)
'$plugins' => array(t('Active plugins'), $a->plugins),
'$showwarning' => $showwarning,
'$warningtext' => $warningtext
));
}



+ 4
- 0
util/convert_innodb.sql Visa fil

@@ -0,0 +1,4 @@

SELECT CONCAT('ALTER TABLE ',table_schema,'.',table_name,' engine=InnoDB;')
FROM information_schema.tables
WHERE engine = 'MyISAM';

+ 8
- 0
view/global.css Visa fil

@@ -473,3 +473,11 @@ td.pendingnote {
td.pendingnote > p > span {
font-weight: bold;
}

/* warning message */
.warning-message {
padding: 10px;
margin: 5px;
border-left: 5px solid #f00;
font-weight: bold;
}

+ 5
- 0
view/templates/admin_summary.tpl Visa fil

@@ -1,6 +1,11 @@

<div id='adminpage'>
<h1>{{$title}} - {{$page}}</h1>
{{if $showwarning}}
<div id="admin-warning-message-wrapper">
<p id="admin-warning-message" class="warning-message">{{$warningtext}}</p>
</div>
{{/if}}

<dl>
<dt>{{$queues.label}}</dt>


Laddar…
Avbryt
Spara