Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
b572608
Merge pull request #1 from RobinTheHood/master
Aug 19, 2020
b67fc78
Update ModuleInfo.tmpl.php
Aug 19, 2020
444af18
Merge remote-tracking branch 'upstream/master'
Aug 20, 2020
278bde1
Merge branch 'modul-link-to-changes-tab'
Aug 20, 2020
ef58afa
Merge remote-tracking branch 'upstream/master'
Aug 20, 2020
5eff1e2
Merge remote-tracking branch 'upstream/master'
Aug 21, 2020
6b6d99d
Merge remote-tracking branch 'upstream/master'
Aug 25, 2020
18cec83
Merge remote-tracking branch 'upstream/master'
Aug 25, 2020
0f94175
Merge remote-tracking branch 'upstream/master'
Aug 25, 2020
22747eb
Merge remote-tracking branch 'upstream/master'
Aug 28, 2020
94cae3d
Merge remote-tracking branch 'upstream/master'
Aug 31, 2020
bd0298b
Merge remote-tracking branch 'upstream/master'
Sep 1, 2020
b93e36e
Merge remote-tracking branch 'upstream/master'
Sep 1, 2020
3ee731a
Merge remote-tracking branch 'upstream/master'
Sep 2, 2020
0cf8c5f
Merge remote-tracking branch 'upstream/master'
Sep 3, 2020
d429787
Heading and other fixes
Sep 3, 2020
3cea0c1
Fix headings not looking good
Sep 3, 2020
7e1f4f2
Fine tune headings
Sep 3, 2020
b00c614
Add extra space to h2
Sep 3, 2020
bc369cf
Update style.css
Sep 3, 2020
8700a15
Merge branch 'heading-styles'
Sep 3, 2020
d8e8396
Merge remote-tracking branch 'upstream/master'
Sep 3, 2020
742d804
Merge remote-tracking branch 'upstream/master'
Sep 4, 2020
7ef1f8d
Merge remote-tracking branch 'upstream/master'
Sep 4, 2020
b97add9
Merge remote-tracking branch 'upstream/master'
Sep 14, 2020
2c30848
Merge remote-tracking branch 'upstream/master'
Sep 16, 2020
6f97233
Merge remote-tracking branch 'upstream/master'
Sep 24, 2020
3541f85
Merge remote-tracking branch 'upstream/master'
Oct 19, 2020
b63580d
Merge branch 'master' of https://github.com/grandeljay/ModifiedModule…
grandeljay Dec 28, 2022
0257491
Merge remote-tracking branch 'upstream/master'
grandeljay Jan 11, 2023
e78648d
Merge remote-tracking branch 'upstream/master'
grandeljay Jan 12, 2023
75d2fb0
Allow defining the shop root
grandeljay Jan 12, 2023
5ae50f0
Refactor
grandeljay Jan 12, 2023
ccc686b
Automatically determine the shop root
grandeljay Jan 12, 2023
57d436d
Merge branch 'master' into fix-get-shop-root
grandeljay Jan 13, 2023
677521c
Revert "Automatically determine the shop root"
grandeljay Jan 13, 2023
25add02
Fix missing log directory
grandeljay Jan 13, 2023
6d3867b
Trim white spaces
grandeljay Jan 13, 2023
d0c0cc1
Set a default, empty shop root
grandeljay Jan 13, 2023
b8bb530
Add shop root UI option
grandeljay Jan 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion config/_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,16 @@
* @param string selfUpdate stable, latest
*/
'installMode' => 'copy',
'selfUpdate' => 'stable'
'selfUpdate' => 'stable',

/**
* Settings revolving around your modified-shop
*
* Overwrite the default shop path. If your MMLC installation is not inside
* of your modified-shop root and exists as a symbolic link, you may need to
* define your shop root here.
*
* Leave empty for default.
*/
'shopRoot' => '',
];
9 changes: 8 additions & 1 deletion src/Classes/Api/V1/HttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,14 @@ public function sendPostRequest(string $url, $data)

// Logging
if ($this->logging) {
file_put_contents(App::getLogsRoot() . '/log.txt', $result);
$logFilepath = App::getLogsRoot() . '/log.txt';
$logDirectory = dirname($logFilepath);

if (!file_exists($logDirectory)) {
mkdir($logDirectory);
}

file_put_contents($logFilepath, $result);
}

return $result;
Expand Down
2 changes: 1 addition & 1 deletion src/Classes/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public static function getRoot(): string

public static function getShopRoot(): string
{
return realPath(__DIR__ . '/../../../');
return Config::getShopRoot();
}

public static function getSrcRoot(): string
Expand Down
20 changes: 20 additions & 0 deletions src/Classes/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,26 @@ public static function setAdminDir(string $newAdminDir): void
self::writeConfiguration(['adminDir' => $newAdminDir]);
}

/**
* Get the modified-shop root directory.
*
* @return string
*/
public static function getShopRoot(): string
{
$shopRootOption = self::getOption('shopRoot');
$shopRootDirectory = empty($shopRootOption)
? realpath(__DIR__ . '/../../../')
: rtrim($shopRootOption, '/\\');

return $shopRootDirectory;
}

public static function setShopRoot(string $newShopRoot): void
{
self::writeConfiguration(['shopRoot' => $newShopRoot]);
}

/**
* Get modulesLocalDir from config.
*
Expand Down
4 changes: 4 additions & 0 deletions src/Classes/IndexController.php
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,10 @@ public function invokeSettings()
Config::setAccessToken($parsedBody['accessToken']);
}

if (isset($parsedBody['shopRoot'])) {
Config::setShopRoot($parsedBody['shopRoot']);
}

if (isset($parsedBody['modulesLocalDir'])) {
Config::setModulesLocalDir($parsedBody['modulesLocalDir']);
}
Expand Down
13 changes: 10 additions & 3 deletions src/Templates/Settings.tmpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ function viewIsSelected(bool $value): string
<input type="text" name="username" class="form-control" id="inputUsername" value="<?= Config::getUsername(); ?>">
<p>Mit diesem Namen meldest du dich im MMLC an.</p>
</div>

<div class="form-group">
<label for="inputPassword">Password</label>
<input type="password" name="password" class="form-control" id="inputPassword">
Expand All @@ -90,6 +90,13 @@ function viewIsSelected(bool $value): string
<div class="tab-pane fade show" id="v-pills-advanced" role="tabpanel" aria-labelledby="v-pills-advanced-tab">
<h2>Erweitert</h2>
<form action="?action=settings&section=advanced" method="post">
<!-- shopRoot -->
<div class="form-group">
<label for="inputShopRoot">Shop Root</label>
<input type="text" name="shopRoot" class="form-control" id="inputShopRoot" value="<?= Config::getShopRoot(); ?>">
<p>Verzeichnis vom modified-shop. Lasse dieses Feld leer für die Standard Einstellung.</p>
</div>

<!-- modulesLocalDir -->
<div class="form-group">
<label for="inputModulesLocalDir">Module Pfad</label>
Expand All @@ -104,7 +111,7 @@ function viewIsSelected(bool $value): string
<option <?= viewIsSelected(Config::getInstallMode() == 'copy') ?> value="copy">copy</option>
<option <?= viewIsSelected(Config::getInstallMode() == 'link') ?> value="link">link</option>
</select>

<p>Du kannst zwischen <code>copy</code> und <code>link</code> wählen. Hast du den MMLC in einem Live-Shop im Einsatz, wähle <code>copy</code>. Wenn du mit dem MMLC Module entwickelst, wähle <code>link</code>.</p>
</div>

Expand All @@ -126,7 +133,7 @@ function viewIsSelected(bool $value): string
$(tabId).tab('show')
})
</script>

<?php include 'Footer.tmpl.php' ?>
</body>
</html>