Plugin Directory

Changeset 3319383


Ignore:
Timestamp:
06/29/2025 09:43:53 AM (9 months ago)
Author:
osamaesh
Message:

display clear message to fix db issue

Location:
wp-stats-manager
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wp-stats-manager/tags/7.9/includes/wsm_init.php

    r3319378 r3319383  
    13751375    static function wsm_viewError()
    13761376    {
     1377        $action_ = isset($_GET['action']) ? $_GET['action'] : '';
     1378        $page_ = isset($_GET['page']) ? $_GET['page'] : '';
     1379       
     1380        if($page_ == 'wsm_traffic' or $action_ == 'fixed_db_issue')
     1381        {
    13771382        global $missing_views;
    13781383    ?>
     
    13851390                <?php
    13861391            } else {
    1387                 if ($missing_views) {
    1388                    
    1389                     $dbUser = defined('DB_USER') ? DB_USER : 'UNKNOWN_USER';
     1392               
     1393                $dbUser = defined('DB_USER') ? DB_USER : 'UNKNOWN_USER';
    13901394                    $dbName = defined('DB_NAME') ? DB_NAME : 'UNKNOWN_DB';
    13911395
     
    14011405                    echo '<p><strong>Note:</strong> Only a server administrator or someone with GRANT permissions can apply this fix.</p>';
    14021406                    echo '</div>';
     1407                   
     1408                if ($missing_views) {
    14031409                ?>
    14041410                    <p><?php echo sprintf(__('There is still %d tables are missing. Please click on below button to fix the issue.', 'wphr'), esc_html($missing_views)); ?></p>
     
    14091415                   
    14101416                   
    1411                     $dbUser = defined('DB_USER') ? DB_USER : 'UNKNOWN_USER';
    1412                     $dbName = defined('DB_NAME') ? DB_NAME : 'UNKNOWN_DB';
    1413 
    1414                     echo '<div style="border:1px solid #e00; padding:15px; background:#fff3f3; color:#a00; font-family:sans-serif; margin-top:20px;">';
    1415                     echo '<h3>⚠️ Database Privileges Issue</h3>';
    1416                     echo '<p>Your current database user <strong>' . esc_html($dbUser) . '</strong> does not have permission to create views.</p>';
    1417                     echo '<p>This is required by the plugin or feature you are trying to use. To resolve this issue, you have two options:</p>';
    1418                     echo '<ol>';
    1419                     echo '<li><strong>Recommended:</strong> Ask your hosting provider to run the following SQL command:</li>';
    1420                     echo '<pre style="background:#f9f9f9; padding:10px; border:1px dashed #ccc;">GRANT CREATE VIEW, SHOW VIEW ON `' . esc_html($dbName) . '`.* TO \'' . esc_html($dbUser) . '\'@\'localhost\';</pre>';
    1421                     echo '<li>Alternatively, switch to a MySQL user that already has <code>CREATE VIEW</code> privileges.</li>';
    1422                     echo '</ol>';
    1423                     echo '<p><strong>Note:</strong> Only a server administrator or someone with GRANT permissions can apply this fix.</p>';
    1424                     echo '</div>';
     1417                   
    14251418                ?>
    14261419               
     
    14341427        </div>
    14351428    <?php
     1429    }
    14361430    }
    14371431    static function wsm_adminIncludeScripts()
  • wp-stats-manager/trunk/includes/wsm_init.php

    r3319378 r3319383  
    13751375    static function wsm_viewError()
    13761376    {
     1377        $action_ = isset($_GET['action']) ? $_GET['action'] : '';
     1378        $page_ = isset($_GET['page']) ? $_GET['page'] : '';
     1379       
     1380        if($page_ == 'wsm_traffic' or $action_ == 'fixed_db_issue')
     1381        {
    13771382        global $missing_views;
    13781383    ?>
     
    13851390                <?php
    13861391            } else {
    1387                 if ($missing_views) {
    1388                    
    1389                     $dbUser = defined('DB_USER') ? DB_USER : 'UNKNOWN_USER';
     1392               
     1393                $dbUser = defined('DB_USER') ? DB_USER : 'UNKNOWN_USER';
    13901394                    $dbName = defined('DB_NAME') ? DB_NAME : 'UNKNOWN_DB';
    13911395
     
    14011405                    echo '<p><strong>Note:</strong> Only a server administrator or someone with GRANT permissions can apply this fix.</p>';
    14021406                    echo '</div>';
     1407                   
     1408                if ($missing_views) {
    14031409                ?>
    14041410                    <p><?php echo sprintf(__('There is still %d tables are missing. Please click on below button to fix the issue.', 'wphr'), esc_html($missing_views)); ?></p>
     
    14091415                   
    14101416                   
    1411                     $dbUser = defined('DB_USER') ? DB_USER : 'UNKNOWN_USER';
    1412                     $dbName = defined('DB_NAME') ? DB_NAME : 'UNKNOWN_DB';
    1413 
    1414                     echo '<div style="border:1px solid #e00; padding:15px; background:#fff3f3; color:#a00; font-family:sans-serif; margin-top:20px;">';
    1415                     echo '<h3>⚠️ Database Privileges Issue</h3>';
    1416                     echo '<p>Your current database user <strong>' . esc_html($dbUser) . '</strong> does not have permission to create views.</p>';
    1417                     echo '<p>This is required by the plugin or feature you are trying to use. To resolve this issue, you have two options:</p>';
    1418                     echo '<ol>';
    1419                     echo '<li><strong>Recommended:</strong> Ask your hosting provider to run the following SQL command:</li>';
    1420                     echo '<pre style="background:#f9f9f9; padding:10px; border:1px dashed #ccc;">GRANT CREATE VIEW, SHOW VIEW ON `' . esc_html($dbName) . '`.* TO \'' . esc_html($dbUser) . '\'@\'localhost\';</pre>';
    1421                     echo '<li>Alternatively, switch to a MySQL user that already has <code>CREATE VIEW</code> privileges.</li>';
    1422                     echo '</ol>';
    1423                     echo '<p><strong>Note:</strong> Only a server administrator or someone with GRANT permissions can apply this fix.</p>';
    1424                     echo '</div>';
     1417                   
    14251418                ?>
    14261419               
     
    14341427        </div>
    14351428    <?php
     1429    }
    14361430    }
    14371431    static function wsm_adminIncludeScripts()
Note: See TracChangeset for help on using the changeset viewer.