-
-
Save mrcave/38b431c0415c611f9366296d1725d0d6 to your computer and use it in GitHub Desktop.
Disable multitenant plugin, theme, core access
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define('MASTER_INSTALL', true); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
define( 'WP_CONTENT_DIR', __DIR__.'/wp-content' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mv wp-config.php tenant-config.php && \ | |
rm -rf wp-admin && \ | |
ln -s /var/www/webroot/ROOT/master/wp-admin wp-admin && \ | |
rm -rf wp-includes && \ | |
ln -s /var/www/webroot/ROOT/master/wp-includes wp-includes && \ | |
rm -rf wp-content/plugins && \ | |
ln -s /var/www/webroot/ROOT/master/wp-content/plugins wp-content/plugins && \ | |
rm -rf wp-content/themes && \ | |
ln -s /var/www/webroot/ROOT/master/wp-content/themes wp-content/themes && \ | |
rm -rf wp-content/mu-plugins && \ | |
ln -s /var/www/webroot/ROOT/master/wp-content/mu-plugins wp-content/mu-plugins | |
rm wp-content/object-cache.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-content/object-cache.php wp-content/object-cache.php | |
rm index.php && \ | |
ln -s /var/www/webroot/ROOT/master/index.php index.php && \ | |
rm wp-activate.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-activate.php wp-activate.php && \ | |
rm wp-blog-header.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-blog-header.php wp-blog-header.php && \ | |
rm wp-comments-post.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-comments-post.php wp-comments-post.php && \ | |
rm wp-cron.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-cron.php wp-cron.php && \ | |
rm wp-links-opml.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-links-opml.php wp-links-opml.php && \ | |
rm wp-load.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-load.php wp-load.php && \ | |
rm wp-login.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-login.php wp-login.php && \ | |
rm wp-mail.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-mail.php wp-mail.php && \ | |
rm wp-settings.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-settings.php wp-settings.php && \ | |
rm wp-signup.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-signup.php wp-signup.php && \ | |
rm wp-trackback.php && \ | |
ln -s /var/www/webroot/ROOT/master/wp-trackback.php wp-trackback.php && \ | |
rm xmlrpc.php && \ | |
ln -s /var/www/webroot/ROOT/master/xmlrpc.php xmlrpc.php | |
#foreach n ( "wp-admin" ) | |
# ln -s /var/www/webroot/master/$n $n1 | |
#end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if (file_exists('/var/www/webroot/ROOT/tenant-config.php')) { | |
include '/var/www/webroot/ROOT/tenant-config.php'; | |
} else { | |
//rest of WP config here | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if(defined('MASTER_INSTALL')){ | |
if(MASTER_INSTALL != 1){ | |
add_filter( 'user_has_cap', 'multitenancy_disable_tenant_updates', 10, 3 ); | |
} | |
} else { | |
add_filter( 'user_has_cap', 'multitenancy_disable_tenant_updates', 10, 3 ); | |
} | |
function multitenancy_disable_tenant_updates( $allcaps, $caps, $args ) | |
{ | |
$caps = array( | |
'delete_plugins', | |
'install_plugins', | |
'edit_plugins', | |
'update_plugins', | |
'update_core', | |
'update_plugins', | |
'update_themes' | |
); | |
foreach ( $caps as $cap ) { | |
$allcaps[$cap] = 0; | |
} | |
return $allcaps; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment