Mkdir() not allowed for plugin://login/pages/.revs


I am seeking if someone can help me with grav-plugin-admin-addon-revisions plugin

It has bug:

When first script run it creates directories .revs. I can see that directories for first time are actually created but with website refresh, whole site not working with error message: mkdir() not allowed for plugin://login/pages/.revs

I think it still tries to create directories but they are there. Plugin has if exists function too but for some reason this does not seem to work


enabled: true
debug: false
directory: .revs
  maximum: 50
  older: 1 year

Plugin is latest stable what grav cli download

Grav v1.7.37.1
Admin Addon Revisions [v1.4.0]

Web files belong to www user/group

Can someone with php/grav knowledge clone this script and provide patch?
I can sponsor

I think it’s great feature (grav revision) what is missing from core

@david1, I see you’ve also logged an issue at the repo of the plugin: mkdir() not allowed for plugin://login/pages/.revs · Issue #28 · david-szabo97/grav-plugin-admin-addon-revisions · GitHub

Unfortunately, the owner is not quite responsive the last few years.

Yes i did. That’s why i offer for someone to clone this script and provide patch. Perhaps fork then?

Ok i have fixed mkdir issue. I will fork and provide patch too but now is other issue:
Maybe grav 1.7 compatible issue?

scandir(plugin://login/pages/.revs): Failed to open directory: "RocketTheme\Toolbox\StreamWrapper\ReadOnlyStream::dir_opendir" call failed"

code itself:

namespace AdminAddonRevisions\Util;

use Grav\Common\Grav;
use Grav\Plugin\AdminAddonRevisionsPlugin;
use AdminAddonRevisions\Util\Diff;

class Util {

  public static function filePathToUrl($filePath) {
    return Grav::instance()['base_url'] . preg_replace('|^' . preg_quote(GRAV_ROOT) . '|', '', $filePath);

  public static function scandir($directory, $fileOnly = true) {
    $files = array_diff(scandir($directory), ['.', '..', AdminAddonRevisionsPlugin::instance()->directoryName()]);

    $files = array_filter($files, function($file) use($directory, $fileOnly) {
      $fileOnlyCondition = is_dir($directory . DS . $file) === !$fileOnly;
      $ignoredCondition = AdminAddonRevisionsPlugin::instance()->isIgnoredFile($directory . DS . $file);

      return $fileOnlyCondition && !$ignoredCondition;

    return $files;

  public static function scandirForFiles($directory) {
    return self::scandir($directory, true);

  public static function scandirForDirectories($directory) {
    return self::scandir($directory, false);

  public static function fileChanged($path1, $path2) {
    return filesize($path1) !== filesize($path2)
            || md5_file($path1) !== md5_file($path2);

  public static function diffToHTML($diff) {
    $html = '';

    foreach ($diff as $c) {
      switch ($c[1]) {
        case Diff::UNMODIFIED:
          $html .= '' . $c[0];
        case Diff::INSERTED:
          $html .= '<span class="inserted">' . $c[0]. '</span>';
        case Diff::DELETED:
          $html .= '<span class="deleted">' . $c[0]. '</span>';

    return $html;


I can pay for this plugin code fix.

@david1, Have you tried emailing your offer to the author directly?

will contact plugin author

Im searching help for grav mkdir function. I thinked it is php native mkdir but not. Following code will result to

 $path = $this->path();
if (is_dir($this->path)) {
    return false;
else {
mkdir($path, 0775, true);

“mkdir() not allowed for plugin://login/pages/.revs”

here is grav mkdir function


    public function mkdir($uri, $mode, $options)
        throw new BadMethodCallException(sprintf('mkdir() not allowed for %s', $uri));

Well… ReadOnlyStream.php name says it cleaarly - it’s a class for read-only access. What’s the question?

Well, plugin calls out mkdir and it is not allowed for some reason. This plugin GitHub - david-szabo97/grav-plugin-admin-addon-revisions: An extension for Grav Admin plugin which adds revisions for pages.

Try in the plugin adding \ before mkdir() in both places - like \mkdir(). It should force to use native php function instead of StreamWrapper. Just not sure how it will handle
plugin stream.

But browsing the code, it looks like it should use Grav\Common\Filesystem\Folder::mkdir(). Not sure why it doesn’t. Would need to debug to figure out

\ did not work. still same error message. i am trying slightly modified my version. Like this one:

if (is_dir($this->path)) {

return false;


else {

\mkdir($this->path, 0775, true);