Skip to content

Commit

Permalink
Changed directory
Browse files Browse the repository at this point in the history
  • Loading branch information
popov654 committed Dec 15, 2023
1 parent 267d01d commit 4f3e8d8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ RUN --mount=type=bind,source=./composer.json,target=composer.json \

FROM php:8.2-apache as base
# RUN docker-php-ext-install pdo pdo_mysql
COPY ./src /var/www/html
COPY *.php /var/www/html/
COPY ./src /var/www/html/src
COPY ./articles /var/www/html/articles
COPY ./uploads /var/www/html/uploads

Expand Down
3 changes: 2 additions & 1 deletion src/editor.php → editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

use Diff\ArrayComparer\StrictArrayComparer;

require "controller.php";
require "vendor/autoload.php";
require "src/controller.php";

if (!isset($_GET['action'])) {
$_GET['action'] = 'get';
Expand Down
3 changes: 2 additions & 1 deletion src/index.php → index.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
require "controller.php";
require "vendor/autoload.php";
require "src/controller.php";
?>
<html>
<head>
Expand Down
13 changes: 1 addition & 12 deletions src/controller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

require Controller::getRootDirectory() . 'vendor/autoload.php';

use League\CommonMark\Environment\Environment;
use League\CommonMark\Extension\Autolink\AutolinkExtension;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
Expand All @@ -18,18 +16,9 @@
use League\CommonMark\Node\Block\Document;

class Controller {
public static function getRootDirectory(): String {
if (preg_match("/html$/", getcwd())) {
return '';
}
return '../';
}

public static function getArticlesDirectory(): String {
if (preg_match("/html$/", getcwd())) {
return 'articles/';
}
return '../articles/';
return getcwd() . '/articles/';
}

public static function getArticlesList(): Array {
Expand Down

0 comments on commit 4f3e8d8

Please sign in to comment.