Server IP : 85.214.239.14 / Your IP : 3.144.28.90 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /var/www/wordpress/phpMyAdmin/js/database/ |
Upload File : |
/* vim: set expandtab sw=4 ts=4 sts=4: */ /** * @fileoverview function used in server privilege pages * @name Database Operations * * @requires jQuery * @requires jQueryUI * @requires js/functions.js * */ /** * Ajax event handlers here for db_operations.php * * Actions Ajaxified here: * Rename Database * Copy Database * Change Charset * Drop Database */ /** * Unbind all event handlers before tearing down a page */ AJAX.registerTeardown('database/operations.js', function () { $(document).off('submit', '#rename_db_form.ajax'); $(document).off('submit', '#copy_db_form.ajax'); $(document).off('submit', '#change_db_charset_form.ajax'); $(document).off('click', '#drop_db_anchor.ajax'); }); AJAX.registerOnload('database/operations.js', function () { /** * Ajax event handlers for 'Rename Database' */ $(document).on('submit', '#rename_db_form.ajax', function (event) { event.preventDefault(); var oldDbName = CommonParams.get('db'); var newDbName = $('#new_db_name').val(); if (newDbName === oldDbName) { Functions.ajaxShowMessage(Messages.strDatabaseRenameToSameName, false, 'error'); return false; } var $form = $(this); var question = Functions.escapeHtml('CREATE DATABASE ' + newDbName + ' / DROP DATABASE ' + oldDbName); Functions.prepareForAjaxRequest($form); $form.confirm(question, $form.attr('action'), function (url) { Functions.ajaxShowMessage(Messages.strRenamingDatabases, false); $.post(url, $('#rename_db_form').serialize() + CommonParams.get('arg_separator') + 'is_js_confirmed=1', function (data) { if (typeof data !== 'undefined' && data.success === true) { Functions.ajaxShowMessage(data.message); CommonParams.set('db', data.newname); Navigation.reload(function () { $('#pma_navigation_tree') .find('a:not(\'.expander\')') .each(function () { var $thisAnchor = $(this); if ($thisAnchor.text() === data.newname) { // simulate a click on the new db name // in navigation $thisAnchor.trigger('click'); } }); }); } else { Functions.ajaxShowMessage(data.error, false); } }); // end $.post() }); }); // end Rename Database /** * Ajax Event Handler for 'Copy Database' */ $(document).on('submit', '#copy_db_form.ajax', function (event) { event.preventDefault(); Functions.ajaxShowMessage(Messages.strCopyingDatabase, false); var $form = $(this); Functions.prepareForAjaxRequest($form); $.post($form.attr('action'), $form.serialize(), function (data) { // use messages that stay on screen $('div.success, div.error').fadeOut(); if (typeof data !== 'undefined' && data.success === true) { if ($('#checkbox_switch').is(':checked')) { CommonParams.set('db', data.newname); CommonActions.refreshMain(false, function () { Functions.ajaxShowMessage(data.message); }); } else { CommonParams.set('db', data.db); Functions.ajaxShowMessage(data.message); } Navigation.reload(); } else { Functions.ajaxShowMessage(data.error, false); } }); // end $.post() }); // end copy database /** * Change tables columns visible only if change tables is checked */ $('#span_change_all_tables_columns_collations').hide(); $('#checkbox_change_all_tables_collations').on('click', function () { $('#span_change_all_tables_columns_collations').toggle(); }); /** * Ajax Event handler for 'Change Charset' of the database */ $(document).on('submit', '#change_db_charset_form.ajax', function (event) { event.preventDefault(); var $form = $(this); Functions.prepareForAjaxRequest($form); Functions.ajaxShowMessage(Messages.strChangingCharset); $.post($form.attr('action'), $form.serialize() + CommonParams.get('arg_separator') + 'submitcollation=1', function (data) { if (typeof data !== 'undefined' && data.success === true) { Functions.ajaxShowMessage(data.message); } else { Functions.ajaxShowMessage(data.error, false); } }); // end $.post() }); // end change charset /** * Ajax event handlers for Drop Database */ $(document).on('click', '#drop_db_anchor.ajax', function (event) { event.preventDefault(); var $link = $(this); /** * @var question String containing the question to be asked for confirmation */ var question = Messages.strDropDatabaseStrongWarning + ' '; question += Functions.sprintf( Messages.strDoYouReally, 'DROP DATABASE `' + Functions.escapeHtml(CommonParams.get('db') + '`') ); var params = Functions.getJsConfirmCommonParam(this, $link.getPostData()); $(this).confirm(question, $(this).attr('href'), function (url) { Functions.ajaxShowMessage(Messages.strProcessingRequest); $.post(url, params, function (data) { if (typeof data !== 'undefined' && data.success) { // Database deleted successfully, refresh both the frames Navigation.reload(); CommonParams.set('db', ''); CommonActions.refreshMain( 'server_databases.php', function () { Functions.ajaxShowMessage(data.message); } ); } else { Functions.ajaxShowMessage(data.error, false); } }); }); }); });