Last active
August 29, 2015 14:26
-
-
Save greg-1-anderson/5a3800443f1f73f9cfcd to your computer and use it in GitHub Desktop.
DEPRECATED: Remove wysiwyg profiles prior to running `drush rs`
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 | |
// n.b. there is a better way: | |
// | |
// https://gist.github.com/greg-1-anderson/a57271f74981de32b878 | |
/** | |
* If any active input filters have wysiwyg profiles, | |
* then ask the user if they should be removed. | |
*/ | |
function drush_rmwysiwyg_pre_runserver() { | |
if (rmwysiwyg_has_wysiwyg_profiles()) { | |
$confirm = drush_confirm(dt("Would you like to delete all wysiwyg profiles before starting the PHP built-in profile? This will LOSE INFORMATION, but if you do not do this, editing a node with a WYSIWYG editor will hang the system.")); | |
if ($confirm) { | |
rmwysiwyg_remove_wysiwyg_profiles(); | |
} | |
} | |
} | |
/** | |
* Check to see if there are any wysiwyg profiles associated | |
* with any active profile. | |
*/ | |
function rmwysiwyg_has_wysiwyg_profiles() { | |
$filter_formats = filter_formats(); | |
foreach ($filter_formats as $key => $info) { | |
$profile = wysiwyg_profile_load($info->format); | |
if (!empty($profile)) { | |
return TRUE; | |
} | |
} | |
return FALSE; | |
} | |
/** | |
* When using the PHP built-in webserver, the wysiwyg editor | |
* will hang forever, because it makes a request to the web server, | |
* and the built-in webserver can only handle one request at a time. | |
* | |
* We therefore remove all wysiwyg editors when running with 'drush rs'. | |
*/ | |
function rmwysiwyg_remove_wysiwyg_profiles() { | |
$filter_formats = filter_formats(); | |
foreach ($filter_formats as $key => $info) { | |
wysiwyg_profile_delete($info->format); | |
} | |
wysiwyg_profile_cache_clear(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment