-
-
Notifications
You must be signed in to change notification settings - Fork 213
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QM should respect DISALLOW_FILE_MODS
#817
Comments
Interesting... the code associated with deleting query-monitor/classes/Activation.php Lines 58 to 61 in 6ca0585
I agree that QM could respect |
I agree that QM should respect However as Caleb said, it should only get deleted if the file belongs to QM in the first place. Does your custom db.php file include a class named |
Crazy timing! I came to look up a different issue and was curious about this one. I've been trying to understand why my db.php symlink kept going away, and it is exactly the case that deactivating it on a single site in multisite removes the symlink (and yes we have DISALLOW_FILE_MODS in place). For reference, I've been manually creating the symlink per the instructions here: https://github.com/johnbillion/query-monitor/wiki/db.php-Symlink |
@JulienMelissas @MadtownLems In the next release, QM won't attempt to create the It doesn't specifically check Cheers! |
Hey @johnbillion - I'm so sorry for not replying back sooner, it turns out GitHub defaulted to sending any follow-up email issues to my personal address which I've been particularly bad at checking this month 😅 To answer the earlier question, no our I really appreciate the code change made and your reasoning makes sense for the first bit, but I personally still feel that if In our case, the subsite deactivation check would fix the individual deactivation problems we saw, but if the plugin was network activated (maybe in a testing environment or something) and then deactivated, it would still bring down the network on file deletion since we have other things in the |
This probably should be re-opened to diagnose |
@JulienMelissas Can you please do one of the following:
As mentioned previously, QM should only delete If any plugins or packages have QM as a dependency, could that be loading |
:scratching_head: |
I mean, wouldn't it evaluate as |
If QM's database drop-in is not present, then the file shouldn't be deleted. That's what the |
@johnbillion Do you think evaluating the contents of $filepaths = array(
constant( 'WP_CONTENT_DIR' ) . '/db.php',
$this->plugin_path( 'wp-content/db.php' ),
);
$file_contents = array_map( 'file_get_contents', $filepaths );
if ( $file_contents[0] === $file_contents[1] ) {
unlink( $filepaths[0] );
} Something similar is done here: Lines 29 to 40 in 2c7107c
Or perhaps something more simple, like checking for |
Right, so the issue we had is:
I'm looking at these lines right now and wondering if somewhere between 2 and 3 |
Seemingly the only path to Is setting permissions on the file to be read-only an option? I'm not very knowledgeable in such things, so might not be an option or solve the problem. |
On some hosts this is possible, for sure, but in our case we don't have access to make changes to file access in production with something like |
We use a custom
db.php
drop-in with a few things we need in production (like connecting to a DB on GCP with certs). We also useDISALLOW_FILE_MODS
hoping that most plugins won't make changes to files on the disk if that flag is set to true.We have encountered this twice now where we'll deactivate QM on a sub site and it'll delete the
db.php
file completely, bringing down all of the sites on our network. For now we are removing the plugin just in case someone forgets or accidentally disables. It would be great ifdb.php
wasn't deleted ifDISALLOW_FILE_MODS
is set to true.Let me know if you need any other information, thank you!
The text was updated successfully, but these errors were encountered: