ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
CanCreateFilesInDirectoryCondition.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4 
5 namespace ILIAS\Setup;
6 
8 {
9  const PROBE_NAME = "probe_for_file_creation";
10 
11  public function __construct($which)
12  {
13  return parent::__construct(
14  "Can create files in '$which'",
15  function (Environment $env) use ($which) : bool {
16  $probe = $which . "/" . self::PROBE_NAME;
17  if (!@file_put_contents($probe, self::PROBE_NAME)) {
18  return false;
19  }
20  $success = @file_get_contents($probe) == self::PROBE_NAME;
21  unlink($probe);
22  return $success;
23  },
24  "ILIAS needs to be able to create files in '$which'."
25  );
26  }
27 }
A condition that can&#39;t be met by ILIAS itself needs to be met by some external means.
$success
Definition: Utf8Test.php:86
An environment holds resources to be used in the setup process.
Definition: Environment.php:11
__construct(Container $dic, ilPlugin $plugin)