Jelajahi Sumber

[Bugs] Issue in PMA feature (#1590)

* Added correct install to uninstall
Fixed issue with pma unable to select database

* Spell check
Jaap Marcus 5 tahun lalu
induk
melakukan
982ca6258c

+ 1 - 1
bin/v-add-sys-pma-sso

@@ -34,7 +34,7 @@ if [ "x$(id -u)" != 'x0' ]; then
 fi
 
 if [ ! -z "$PHPMYADMIN_KEY" ] && [ "$PHPMYADMIN_KEY" != "" ] ; then
-    echo "Error: SSO has been installed before to reenable it please run v-delete-pma-sso first"
+    echo "Error: SSO has been installed before to reenable it please run v-delete-sys-pma-sso first"
     exit 1;
 fi
 

+ 3 - 1
install/deb/phpmyadmin/config.inc.php

@@ -25,7 +25,9 @@ $cfg['SaveDir'] = '';
  * You can find more configuration options in the documentation
  * in the doc/ folder or at <https://docs.phpmyadmin.net/>.
  */
- $i = 0;
+
+ //start with 1 other wise it doesn't work
+ $i = 1;
  foreach (glob('/etc/phpmyadmin/conf.d/*.php') as $filename)
  {
      include($filename);

+ 1 - 0
install/deb/phpmyadmin/hestia-sso.php

@@ -145,6 +145,7 @@ function session_invalid(){
                         $data = $api -> create_temp_user($database,$user, $host);
                         $_SESSION['PMA_single_signon_user'] = $data -> login -> user;
                         $_SESSION['PMA_single_signon_password'] = $data -> login -> password ; 
+                        $_SESSION['PMA_single_signon_host'] = $host;
                         //save database / username to be used for sending logout notification. 
                         $_SESSION['HESTIA_sso_user'] = $user;
                         $_SESSION['HESTIA_sso_database'] = $database;

+ 28 - 26
install/deb/phpmyadmin/pma.sh

@@ -13,32 +13,34 @@
 PASS=$(gen_pass)
 
 #ubuntu phpmyadmin path
-pmapath1="/etc/phpmyadmin/conf.d/01-localhost.php"
-
-echo "\$cfg['Servers'][\$i]['favorite'] = 'pma__favorite';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['central_columns'] = 'pma__central_columns';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['designer_settings'] = 'pma__designer_settings';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['export_templates'] = 'pma__export_templates';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['savedsearches'] = 'pma__savedsearches';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['navigationhiding'] = 'pma__navigationhiding';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['users'] = 'pma__users';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['pmadb'] = 'phpmyadmin';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['controluser'] = 'pma';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['controlpass'] = '$PASS';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['bookmarktable'] = 'pma__bookmark';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['relation'] = 'pma__relation';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['userconfig'] = 'pma__userconfig';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['table_info'] = 'pma__table_info';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['column_info'] = 'pma__column_info';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['history'] = 'pma__history';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['recent'] = 'pma__recent';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['table_uiprefs'] = 'pma__table_uiprefs';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['tracking'] = 'pma__tracking';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['table_coords'] = 'pma__table_coords';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['pdf_pages'] = 'pma__pdf_pages';" >> $pmapath1
-echo "\$cfg['Servers'][\$i]['designer_coords'] = 'pma__designer_coords';" >> $pmapath1
+pmapath="/etc/phpmyadmin/conf.d/01-localhost.php"
+echo "<?php " >> $pmapath
+echo "\$cfg['Servers'][\$i]['host'] = 'localhost';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['port'] = '3306';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['favorite'] = 'pma__favorite';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['central_columns'] = 'pma__central_columns';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['designer_settings'] = 'pma__designer_settings';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['export_templates'] = 'pma__export_templates';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['savedsearches'] = 'pma__savedsearches';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['navigationhiding'] = 'pma__navigationhiding';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['users'] = 'pma__users';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['pmadb'] = 'phpmyadmin';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['controluser'] = 'pma';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['controlpass'] = '$PASS';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['bookmarktable'] = 'pma__bookmark';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['relation'] = 'pma__relation';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['userconfig'] = 'pma__userconfig';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['table_info'] = 'pma__table_info';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['column_info'] = 'pma__column_info';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['history'] = 'pma__history';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['recent'] = 'pma__recent';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['table_uiprefs'] = 'pma__table_uiprefs';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['tracking'] = 'pma__tracking';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['table_coords'] = 'pma__table_coords';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['pdf_pages'] = 'pma__pdf_pages';" >> $pmapath
+echo "\$cfg['Servers'][\$i]['designer_coords'] = 'pma__designer_coords';" >> $pmapath
 
 #SOME WORK with DATABASE (table / user)
 PMADB=phpmyadmin

+ 33 - 29
install/upgrade/manual/migrate_phpmyadmin.sh

@@ -18,7 +18,7 @@ source $HESTIA/conf/hestia.conf
 #----------------------------------------------------------#
 
 echo "For deleting PHPmyAdmin you will need confirm the removal with root password. Password can be found in /usr/local/hestia/conf/mysql.conf"
-read -p "Please enter Y to continue" -n 1 -r
+read -p 'Would you like to continue? [y/n]'
 echo    # (optional) move to a new line
 if [[ $REPLY =~ ^[Yy]$ ]]
 then
@@ -69,7 +69,7 @@ then
    # Create copy of config file
    cp -f $HESTIA_INSTALL_DIR/phpmyadmin/config.inc.php /etc/phpmyadmin/
    mkdir -p /var/lib/phpmyadmin/tmp
-   chmod 777 /var/lib/phpmyadmin/tmp
+   chmod 777 -R /var/lib/phpmyadmin/tmp
    
    # Set config and log directory
    sed -i "s|define('CONFIG_DIR', ROOT_PATH);|define('CONFIG_DIR', '/etc/phpmyadmin/');|" /usr/share/phpmyadmin/libraries/vendor_config.php
@@ -83,7 +83,9 @@ then
    rm -fr phpMyAdmin-$pma_v-all-languages
    rm -f phpMyAdmin-$pma_v-all-languages.tar.gz
    
-   echo "DB_PMA_ALIAS='phpmyadmin'" >> $HESTIA/conf/hestia.conf
+   if [ -z '$DB_PMA_ALIAS' ]; then
+       echo "DB_PMA_ALIAS='phpmyadmin'" >> $HESTIA/conf/hestia.conf
+   fi
    $HESTIA/bin/v-change-sys-db-alias 'pma' "phpmyadmin"
 
    # Special thanks to Pavel Galkin (https://skurudo.ru)
@@ -91,32 +93,34 @@ then
    
    echo "[ * ] Createing localhost config"
    #ubuntu phpmyadmin path
-   pmapath1="/etc/phpmyadmin/conf.d/01-localhost.php"
-   
-   echo "\$cfg['Servers'][\$i]['favorite'] = 'pma__favorite';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['central_columns'] = 'pma__central_columns';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['designer_settings'] = 'pma__designer_settings';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['export_templates'] = 'pma__export_templates';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['savedsearches'] = 'pma__savedsearches';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['navigationhiding'] = 'pma__navigationhiding';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['users'] = 'pma__users';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['pmadb'] = 'phpmyadmin';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['controluser'] = 'pma';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['controlpass'] = '$PASS';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['bookmarktable'] = 'pma__bookmark';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['relation'] = 'pma__relation';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['userconfig'] = 'pma__userconfig';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['table_info'] = 'pma__table_info';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['column_info'] = 'pma__column_info';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['history'] = 'pma__history';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['recent'] = 'pma__recent';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['table_uiprefs'] = 'pma__table_uiprefs';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['tracking'] = 'pma__tracking';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['table_coords'] = 'pma__table_coords';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['pdf_pages'] = 'pma__pdf_pages';" >> $pmapath1
-   echo "\$cfg['Servers'][\$i]['designer_coords'] = 'pma__designer_coords';" >> $pmapath1
+   pmapath="/etc/phpmyadmin/conf.d/01-localhost.php"
+   echo "<?php " >> $pmapath
+   echo "\$cfg['Servers'][\$i]['host'] = 'localhost';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['port'] = '3306';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['favorite'] = 'pma__favorite';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['central_columns'] = 'pma__central_columns';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['designer_settings'] = 'pma__designer_settings';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['export_templates'] = 'pma__export_templates';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['savedsearches'] = 'pma__savedsearches';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['navigationhiding'] = 'pma__navigationhiding';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['users'] = 'pma__users';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['usergroups'] = 'pma__usergroups';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['pmadb'] = 'phpmyadmin';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['controluser'] = 'pma';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['controlpass'] = '$PASS';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['bookmarktable'] = 'pma__bookmark';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['relation'] = 'pma__relation';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['userconfig'] = 'pma__userconfig';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['table_info'] = 'pma__table_info';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['column_info'] = 'pma__column_info';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['history'] = 'pma__history';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['recent'] = 'pma__recent';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['table_uiprefs'] = 'pma__table_uiprefs';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['tracking'] = 'pma__tracking';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['table_coords'] = 'pma__table_coords';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['pdf_pages'] = 'pma__pdf_pages';" >> $pmapath
+   echo "\$cfg['Servers'][\$i]['designer_coords'] = 'pma__designer_coords';" >> $pmapath
    
    #SOME WORK with DATABASE (table / user)
    PMADB=phpmyadmin