Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter Daedalon

    (@daedalon)

    This was likely caused by a server-side issue that is now fixed. Marking as resolved as this likely isn’t a BPS issue at all.

    Thread Starter Daedalon

    (@daedalon)

    Actually, it seems that the issue was related to running out of disk space. There’s one thing that BPS could do related to this:

    When trying to save a new .htaccess file, handle the situation of no disk space correctly.

    At the moment the error message doesn’t say why the save failed. It could also be good to check disk space before attempting to write anything on the disk to avoid first erasing the .htaccess and then not being able to write into it. On our test site when trying to save the .htaccess file we started seeing errors after that saying that the site isn’t protected by BPS, indicating that the failed attempt to save decreased the protection that was in place before that.

    Plugin Author AITpro

    (@aitpro)

    hmm never even thought about checking for disk space since the .htaccess files are so small – only 12KB – 20KB. If you are running that close to running out of disk space that is pretty scary. LOL

    But in general I think this would be a good thing to add to the BPS System Info page. Thanks for the great idea! ??

    Plugin Author AITpro

    (@aitpro)

    And even better then just having a check for disk space in write functions themselves would be to add a Dashboard Alert – “WARNING! Disk Space is extremely low: X size Y remaining!”

    Thread Starter Daedalon

    (@daedalon)

    Agreed on all counts.

    Our test environments occasionally hit limitations like these, partly in order to weed out possible issues like these as early as possible.

    Plugin Author AITpro

    (@aitpro)

    Yep, thanks again for the awesome idea! Can’t believe that idea never popped into my head. ??

    Plugin Author AITpro

    (@aitpro)

    Oh well after testing this idea it is a no go. Unless you have root access to a VPS or Dedicated Server then what is displayed to you is the Server’s disk space and not your individual hosting account space. So there is no way to check if disk space is available in a function. Neat idea, but would not work.

    Server Disk Free Space: 1.77 TB
    Server Disk Total Space: 8.50 TB

    $bytesFree = disk_free_space(ABSPATH);
    $bytesTotal = disk_total_space(ABSPATH);
    $units = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
    $base = 1024;
    $classFree = min((int)log($bytesFree, $base), count($units) - 1);
    $classTotal = min((int)log($bytesTotal, $base), count($units) - 1);
    
    echo sprintf('Server Disk Free Space:<strong> '.'%1.2f', $bytesFree / pow($base, $classFree)) . ' ' . $units[$classFree] . '</strong>';
    
    echo sprintf('Server Disk Total Space:<strong> '.'%1.2f', $bytesTotal / pow($base, $classTotal)) . ' ' . $units[$classTotal] . '</strong>';
    Thread Starter Daedalon

    (@daedalon)

    Plugin Author AITpro

    (@aitpro)

    That function is specifically for Network/Multisite. There is a quota feature in Network/Multisite where you can allot a certain amount of quota/space for each site. I looked around a bit and did not find a way to do this on a Hosted account. The code above with some additional code works great on my in-house LAMP and my Stand Alone Apache Test Servers, but of course I am the Admin/have root access to the Servers. ??

    Thread Starter Daedalon

    (@daedalon)

    Plugin Author AITpro

    (@aitpro)

    Not sure if WordPress would address something like this since it is a plugin issue vs a WordPress Core issue and WordPress is actually already addressing this via the WordPress Filesystem API.

    In any case we are currently working on DSO automation coding and it just so happens that one of the tests/checks performed using the WordPress Filesystem API is to copy a tmp file exactly the way WordPress is already doing this to determine if a Server allows one of the Filesystem API methods.

    So the solution is not to try and get disk space since I imagine that would be either very difficult or just impossible for every Server type, environment, etc. The solution is to do what WordPress is already doing – copy a tmp file to determine if file writing is possible on the Server.

    So logically you copy a tmp file of a certain size (or maybe several copies using increasing tmp file sizes) to determine the amount of disk space left that is available.

    So then here is the other problem: What is the range of low disk space.

    Example: for 1 person that might be 100MB and for another person that might be 100KB and for another person that might be 1GB. You get my point.

    So the only way to logically check the range that each person considers low disk space an option would have to be created that that person would have to set.

    Example: When disk space reaches X warn me. In order to automate the check a Cron could be used to copy a tmp file with the size X in order to get the alert to fire.

    Researching this we found that since the Server/Control panel is better suited for something like this then it may be reinventing the wheel, but may be useful. This is being explored further for usefulness.

    Back to how BPS will be doing a check this can be simply a check exactly the way that WordPress handles this. They unpack tmp files to the /upgrade folder. If disk space runs out the upgrade does not proceed any further by coping those files to the destination folder. So BPS can do either the same thing or something very similar to determine if enough disk space is left for BPS to do what it needs to do.

    In summation, a check such as this has value, but the majority of folks these days are given either unlimited disk space or such a large volume of disk space that this is really not a very common issue.

    Thread Starter Daedalon

    (@daedalon)

    What is the range of low disk space.

    Ideally WordPress would have a function for saving to the file system that checks that there is space for the saving in advance if needed. Before that, the first point would be that WP core plugin update feature would give a more informative error message saying the reason for failing to write. I haven’t looked into the BPS update process to be able to comment whether this should be implemented in core or plugins.

    As for a general warning of low disk space, the way I visualize it is to have a system status widget in WP-admin with a bar meter showing how much free space there is in percentage terms, sliding from green to red as there’s less space. Next to it would be numbers. Much like what Windows Vista and 7 show for hard drives in Windows Explorer.

    Plugin Author AITpro

    (@aitpro)

    Yes, WordPress does already do that see above.

    I continued to add more information to my original post and I believe this additional information may answer some of your questions already.

    I have come up with a logical way of doing this above since i believe it is not possible to check disk space via the WordPress Dashboard/plugin. See the addtional info i added in my original post.

    Thread Starter Daedalon

    (@daedalon)

    So the solution is not to try and get disk space since I imagine that would be either very difficult or just impossible for every Server type, environment, etc.

    I agree partially. As I understood, it might make sense to implement this in PHP level rather than WP. Hard is not the issue as much as whether it’s too hard compared to the usefulness. I can see a number of applications for this in a range of PHP projects. However, I can’t comment on how hard it would be to get this to work in the most relevant, say, 50% of server setups.

    The first implementation would naturally work on only some server setups, an amount which would be improved by subsequent updates.

    Things aren’t always as we’d expect them to be, but I’d think there are already some pieces of code that have the relevant code mostly implemented. I’d expect many pieces of software making use of the knowledge of how much disk space there is available. Thanks to the world of open source, PHP should be able to use that if this is too low-level for WP. So I’d see it mostly a question of whether a plugin or WP or PHP core contributor would see it as worth the work inevitably involved.

    Plugin Author AITpro

    (@aitpro)

    Here is the thing. If you use the available php functions to check for disk space then what is returned is the disk space for the Server and not an individual website. There is currently no php function created/designed/built/exists that can check the disk space available for an individual website.

    So based on that logic you would need to figure out an alternative method of finding available disk space for an individual website and this idea below in theory should work:

    So the only way to logically check the range that each person considers low disk space an option would have to be created that that person would have to set.

    Example: When disk space reaches X warn me. In order to automate the check a Cron could be used to copy a tmp file with the size X in order to get the alert to fire.

    In summation, PHP themselves do not currently have a function that is capable of finding an individual website’s available disk space. It is possible to figure this out by using the logical theory I have come up with above.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Error on updating to .49’ is closed to new replies.