Update active plugin list if one is missing upon activation
git-svn-id: http://yourls.googlecode.com/svn/trunk@367 12232710-3e20-11de-b438-597f59cd7555
This commit is contained in:
parent
fe3470bd03
commit
e3d0e0cc97
@ -38,21 +38,16 @@ if( isset( $_GET['action'] ) ) {
|
||||
$result = 'No plugin specified, or not a valid plugin';
|
||||
}
|
||||
|
||||
$result = yourls_notice_box( $result );
|
||||
yourls_add_action('admin_notices', create_function( '', "echo '$result';" ) );
|
||||
yourls_add_notice( $result );
|
||||
}
|
||||
|
||||
// Handle message upon succesfull (de)activation
|
||||
if( isset( $_GET['success'] ) ) {
|
||||
if( $_GET['success'] == 'activated' OR $_GET['success'] == 'deactivated' ) {
|
||||
$result = yourls_notice_box( 'Plugin '.$_GET['success'] );
|
||||
yourls_add_action('admin_notices', create_function( '', "echo '$result';" ) );
|
||||
yourls_add_notice( 'Plugin '.$_GET['success'] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// TODO: UPDATE PLUGIN LIST IF ONE IS MISSING ?
|
||||
|
||||
yourls_html_head( 'plugins' );
|
||||
yourls_html_logo();
|
||||
yourls_html_menu();
|
||||
@ -134,7 +129,7 @@ yourls_html_menu();
|
||||
yourls_defaultorder = 0;
|
||||
</script>
|
||||
|
||||
<p>If something goes wrong after you activate a plugin, simply delete its directory, or rename the plugin file to something different than <code>plugin.php</code>.
|
||||
<p>If something goes wrong after you activate a plugin and you cannot use YOURLS or access this page, simply rename or delete its directory, or rename the plugin file to something different than <code>plugin.php</code>.</p>
|
||||
|
||||
|
||||
<?php yourls_html_footer(); ?>
|
@ -322,12 +322,21 @@ function yourls_load_plugins() {
|
||||
if( !$active_plugins OR ( defined( 'YOURLS_INSTALLING' ) AND YOURLS_INSTALLING ) OR yourls_upgrade_is_needed() )
|
||||
return;
|
||||
|
||||
foreach( (array)$active_plugins as $plugin ) {
|
||||
foreach( (array)$active_plugins as $key=>$plugin ) {
|
||||
if( yourls_validate_plugin_file( YOURLS_PLUGINDIR.'/'.$plugin ) ) {
|
||||
include_once( YOURLS_PLUGINDIR.'/'.$plugin );
|
||||
$ydb->plugins[] = $plugin;
|
||||
unset( $active_plugins[$key] );
|
||||
}
|
||||
}
|
||||
|
||||
// $active_plugins should be empty now, if not, a plugin could not be find: remove it
|
||||
if( count( $active_plugins ) ) {
|
||||
$missing = '<strong>'.join( '</strong>, <strong>', $active_plugins ).'</strong>';
|
||||
yourls_update_option( 'active_plugins', $ydb->plugins );
|
||||
$message = 'Could not find and deactivated '. yourls_plural( 'plugin', count( $active_plugins ) ) .' '. $missing;
|
||||
yourls_add_notice( $message );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -421,4 +430,4 @@ function yourls_plugin_basename( $file ) {
|
||||
$plugindir = yourls_sanitize_filename( YOURLS_PLUGINDIR );
|
||||
$file = str_replace( $plugindir, '', $file );
|
||||
return trim( $file, '/' );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user