Skip to content

Instantly share code, notes, and snippets.

View hissy's full-sized avatar
💭
😄

Takuro Hishikawa hissy

💭
😄
View GitHub Profile
@hissy
hissy / fix-font-size.css
Created March 19, 2024 02:24
[Concrete CMS] バージョン9対応 html 要素に font-size: 0.625rem が入っている時の対応CSSスニペット
body .ccm-ui dl,
body .ccm-ui dt,
body .ccm-ui dd,
body .ccm-ui ol,
body .ccm-ui ul,
body .ccm-ui li,
body .ccm-ui p,
body .ccm-ui th,
body .ccm-ui td,
body .ccm-ui a,
@hissy
hissy / app.php
Last active December 24, 2023 23:57
[Concrete CMS] Unapprove page versions when a page is duplicated
<?php
if ($app->isInstalled()) {
// Register Events
/** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $eventDispatcher */
$eventDispatcher = $app->make(\Symfony\Component\EventDispatcher\EventDispatcherInterface::class);
// Unapprove page versions when a page is duplicated
$eventDispatcher->addListener('on_page_duplicate', function ($event) {
/** @var \Concrete\Core\Page\DuplicatePageEvent $event */
@hissy
hissy / bulk_move_pages
Last active March 17, 2023 03:57
Automated job to move all pages under old parent to new parent
<?php
namespace Application\Job;
use Concrete\Core\Job\QueueableJob;
use Concrete\Core\Page\Page;
use Concrete\Core\Page\PageList;
use ZendQueue\Message as ZendQueueMessage;
use ZendQueue\Queue as ZendQueue;
class BulkMovePages extends QueueableJob
@hissy
hissy / delete_uncompleted_processes.php
Last active February 28, 2023 11:12
[Concrete CMS] Delete Uncompleted Processes
<?php
$app = \Concrete\Core\Support\Facade\Application::getFacadeApplication();
/** @var \Doctrine\ORM\EntityManagerInterface $em */
$em = $app->make(\Doctrine\ORM\EntityManagerInterface::class);
/** @var \Concrete\Core\Entity\Command\ProcessRepository $repository */
$repository = $em->getRepository(\Concrete\Core\Entity\Command\Process::class);
$processes = $repository->findRunning();
/** @var \Concrete\Core\Command\Process\ProcessUpdater $updater */
$updater = $app->make(\Concrete\Core\Command\Process\ProcessUpdater::class);
@hissy
hissy / FileItem.php
Created February 15, 2023 12:24
[Concrete CMS] [Migration Tool] Inspect file by fvTitle instead of fvFilename
<?php
// application/src/Backup/ContentImporter/ValueInspector/Item/FileItem.php
namespace Application\Backup\ContentImporter\ValueInspector\Item;
use Concrete\Core\File\File;
class FileItem extends \Concrete\Core\Backup\ContentImporter\ValueInspector\Item\FileItem
{
@hissy
hissy / site.php
Last active February 15, 2023 03:09
[Concrete CMS] Change Ckeditor DTD settings
<?php
// application/config/site.php
// https://ckeditor.com/docs/ckeditor4/latest/api/CKEDITOR_dtd.html
$dtd = <<<END
CKEDITOR.dtd['a']['div'] = 1;
END;
return [
'sites' => [
@hissy
hissy / Updater.php
Last active January 6, 2024 14:00
Concrete CMS: A helper class to install CIF format xml files without duplicated run
<?php
namespace Acme\Updater;
use Concrete\Core\Entity\Package as PackageEntity;
use Concrete\Core\Package\Package;
use Symfony\Component\Finder\Finder;
class Updater
{
@hissy
hissy / clear_invalid_workflow_notifications.php
Last active June 21, 2022 07:49
#ConcreteCMS A job to clear invalid workflow notifications
<?php
// application/jobs/clear_invalid_workflow_notifications.php
namespace Application\Job;
use Concrete\Core\Entity\Notification\WorkflowProgressNotification;
use Concrete\Core\Job\Job;
use Concrete\Core\Support\Facade\Application;
use Doctrine\ORM\EntityManagerInterface;
@hissy
hissy / ClearExpressEntries.php
Created June 18, 2022 13:37
#ConcreteCMS A Command to delete entries of the specific express entity
<?php
// application/src/Express/Command/ClearExpressEntries.php
namespace Application\Express\Command;
use Concrete\Core\Console\Command;
use Concrete\Core\Entity\Express\Entity;
use Concrete\Core\Entity\Express\Entry;
use Concrete\Core\Support\Facade\Application;
use Doctrine\ORM\EntityManagerInterface;
@hissy
hissy / Output.md
Last active March 15, 2022 09:45
[Concrete CMS][8.5.x] Show cache settings of block types ブロックタイプごとのキャッシュ設定
Name Handle Cache Settings Cache Output Cache Output on Post Cache Output For Registered Users Output Cache Lifetime
記事 content 有効 有効 有効 無効 0
HTML html 有効 有効 有効 有効 0
画像 image 有効 有効 有効 無効 0
ファイル file 有効 有効 有効 有効 0
水平線 horizontal_rule 有効 有効 有効 有効 0
特色 feature 有効 有効 有効 有効 0
オートナビ autonav 有効 有効 有効 無効 300
ページタイトル page_title 有効 有効 有効 無効 0