1
0
mirror of https://github.com/typemill/typemill.git synced 2025-08-06 14:16:46 +02:00

Fixed bug when change manual date for post

This commit is contained in:
trendschau
2023-11-22 19:20:02 +01:00
parent 77445f575d
commit 3d4bff397c
4 changed files with 33 additions and 8 deletions

View File

@@ -1,10 +1,11 @@
meta:
navtitle: 'setup your website'
owner: Sebastian
created: '2023-06-12'
time: 22-36-14
modified: '2023-10-23'
title: 'Setup your website'
description: ' You will find all configurations and settings under the main navigation point settings with the following sub-navigation:'
owner: Sebastian
manualdate: '2023-11-22'
modified: '2023-10-23'
created: '2023-06-12'
time: 15-18-48
hide: false
noindex: false

View File

@@ -254,9 +254,13 @@ class ControllerApiAuthorMeta extends Controller
$pathWithoutFile = str_replace($item->originalName, "", $item->path);
$newPathWithoutType = $pathWithoutFile . $datetime . '-' . $item->slug;
$meta->renamePost($item->pathWithoutType, $newPathWithoutType);
$renameresults = $meta->renamePost($item->pathWithoutType, $newPathWithoutType);
$navigation->clearNavigation();
# WE HAVE TO REGENERATE ITEM AND NAVIGATION
$draftNavigation = $navigation->getDraftNavigation($urlinfo, $this->settings['langattr']);
$item = $navigation->getItemWithKeyPath($draftNavigation, $item->keyPathArray);
}
}
@@ -334,14 +338,15 @@ class ControllerApiAuthorMeta extends Controller
$response->getBody()->write(json_encode([
'navigation' => $draftNavigation,
'item' => $item
'item' => $item,
'rename' => $renameresults ?? false
]));
return $response->withHeader('Content-Type', 'application/json');
}
$response->getBody()->write(json_encode([
'message' => $store,
'message' => $store,
]));
return $response->withHeader('Content-Type', 'application/json')->withStatus(500);

View File

@@ -19,6 +19,7 @@ class ApiAuthentication
# check if it is a session based authentication
if ($request->hasHeader('X-Session-Auth'))
{
# proceed, if a session based authentication has been done before in middleware
if($request->getAttribute('c_username') && $request->getAttribute('c_userrole'))
{
$response = $handler->handle($request);
@@ -31,7 +32,6 @@ class ApiAuthentication
}
}
# api authentication with basic auth
# inspired by tuupola
$host = $request->getUri()->getHost();

View File

@@ -178,6 +178,25 @@ class Meta
return false;
}
public function renamePost($oldPathWithoutType,$newPathWithoutType)
{
$filetypes = [
'txt' => true,
'md' => true,
'yaml' => true
];
foreach($filetypes as $filetype => $result)
{
if(!$this->storage->renameFile('contentFolder', '', $oldPathWithoutType . '.' . $filetype, $newPathWithoutType . '.' . $filetype))
{
$filetypes[$filetype] = $this->storage->getError();
}
}
return $filetypes;
}
# just route it to storageWrapper because wrapper is initialized here and we dont want to initialize it in controllers
public function transformPostsToPages($folder)
{