承接 ttree/jobbutler 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ttree/jobbutler

Composer 安装命令:

composer require ttree/jobbutler

包简介

Neos CMS package to help Editors and Administrators to manage Jobs

README 文档

README

StyleCI

Introduction

Neos CMS package to help Editors and Administrators to manage Jobs. Jobs can be anything:

  • Import data from external source
  • Export data (CSV, ...)
  • ETL
  • Analytics
  • ...

Works with Neos CMS 1.2-2.0+. This package is Composer ready, PSR-2 and PSR-4 compliant.

Currently this package is under development and version 1.0 is not out, breaking change can happen

Features

The package provide a backend module with a simple interface where Editors or Administrators can:

  • View all available Jobs
  • Manual Job execution
  • Pass options to a Job before manual execution
  • Filter job list by searching
  • Filter job list by tagging
  • Job can produce files (export), use the DocumentJobTrait
  • Create web hook to trigger job execution from external source
  • Schedule a Job (integrate with Ttree.Scheduler)
  • View the execution history for a given Job

Backend Module

Check the issue tracker to follow ongoing features.

Installation

composer require "ttree/jobbutler"

How to register a new Job

A Job is a PHP class based on JobConfigurationInterface. By default you can use the AbstractJobConfiguration abstract class that offer nice defaults and helpers for general usage.

You can create a simple class like this one:

<?php
namespace Your\Package\JobConfiguration;

use \Ttree\JobButler\Domain\Model\AbstractJobConfiguration;
use \Ttree\JobButler\Domain\Model\DocumentJobTrait;
use \Ttree\JobButler\Domain\Model\JobConfigurationOptions;

/**
 * Export Document Job
 */
class ExportDocumentJob extends AbstractJobConfiguration
{
    use DocumentJobTrait;
    
    public function getIcon()
    {
        return 'print';
    }

    public function execute(JobConfigurationOptions $options = null)
    {
        $context = $this->createContext('live');
        $sideNode = $context->getNode('/sites/yoursite');
        $flowQuery = new FlowQuery(array($sideNode));
        $flowQuery = $flowQuery->find('[instanceof TYPO3.Neos.NodeTypes:Page]');
        $writer = Writer::createFromFileObject(new \SplTempFileObject());
        $writer->insertOne([
            'identifier' => 'Identifier',
            'title' => 'Page Title'
        ]);

        foreach ($flowQuery as $node) {
            /** @var NodeInterface $node */
            $writer->insertOne([
                'identifier' => $node->getIdentifier(),
                'title' => $node->getProperty('title')
            ]);
        }

        $this->writeDocument($this->getOption('document', 'export.csv'), $writer);
        
        return true;
    }

    public function getPackageKey()
    {
        return "Vendor.PackageKey";
    }

}

The method DocumentJobTrait::writeDocument will automatically create a new AssetCollection name "Export" (check Settings.yaml to change the asset collection name). Generated document are stored outside of the public resource folder, check Settings.yaml to change the default path.

Now create a XLIFF file name Jobs.xlf in the same package, with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
    <file original="" product-name="Your.Package" source-language="en" datatype="plaintext">
        <body>
            <trans-unit id="your.package.jobconfiguration.exportdocumentjob.name" xml:space="preserve">
				<source>Export all Pages</source>
			</trans-unit>
			<trans-unit id="your.package.jobconfiguration.exportdocumentjob.description" xml:space="preserve">
				<source>Export a single CSV file with all Pages identifier and title.</source>
			</trans-unit>
        </body>
    </file>
</xliff>

You can extend this Job to get data from Google Analytics and you have a nice spreadsheet to work on Content Inventory ...

Now go to the backend module, you should see your Job, ready for execution.

How to configure a new Job

Ttree:
  JobButler:
    jobSettings:
      'Your\Package\JobConfiguration\ExportDocumentJob':
        'icon': 'circle-arrow-down'
        'wizardFactoryClass': 'Your\Package\JobConfiguration\Wizard\ExportProfileByReportWizard'

Currently the following settings are supported by AbstractJobConfiguration:

  • icon (string), default 'task'
  • tags (array), default emtpy array
  • wizardFactoryClass (string), default null
  • privilegeTarget (string), default null
  • asynchronous (boolean), default false

Adding a configuration Wizard before executing a Job

Your Job need to provide a Form factory to render the form:

    ...
    
    /**
     * {@inheritdoc}
     */
    public function getWizardFactoryClass()
    {
        return 'Your\Package\JobConfiguration\ExportDocumentWizard';
    }
    
    ...

Provide a simple Factor:

<?php
namespace Your\Package\JobConfiguration;

/**
 * Export Profile Index Job
 */
class ExportDocumentWizard extends AbstractFormFactory {

    /**
     * @param array $factorySpecificConfiguration
     * @param string $presetName
     * @return \TYPO3\Form\Core\Model\FormDefinition
     */
    public function build(array $factorySpecificConfiguration, $presetName) {
        $formConfiguration = $this->getPresetConfiguration($presetName);
        $form = new FormDefinition('options', $formConfiguration);

        $page = $form->createPage('page');

        $reportIdentifier = $page->createElement('reportIdentifier', 'TYPO3.Form:SingleLineText');
        $reportIdentifier->setLabel('Report Identifier');
        $reportIdentifier->addValidator(new NotEmptyValidator());

        return $form;
    }
}

The ``RenderViewHelper``` take care for the finisher configuration and arguments processing.

Settings

  • maximumExecutionTime: Override the system maximum excution time from the php.ini (default: 300)

Acknowledgments

Development sponsored by ttree ltd - neos solution provider.

We try our best to craft this package with a lots of love, we are open to sponsoring, support request, ... just contact us.

License

The MIT License (MIT). Please see LICENSE for more information.

ttree/jobbutler 适用场景与选型建议

ttree/jobbutler 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 641 次下载、GitHub Stars 达 5, 最近一次更新时间为 2015 年 11 月 10 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 ttree/jobbutler 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 ttree/jobbutler 我们能提供哪些服务?
定制开发 / 二次开发

基于 ttree/jobbutler 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 641
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 12
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-11-10