vendor/tiben/crontab-manager/src/CrontabManager/CrontabAdapter.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

/*
 * Copyright 2013 Benjamin Legendre
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

namespace TiBeN\CrontabManager;

/**
 * Crontab adapter. 
 * Retrieve and write cron jobs data using the "crontab" command line.
 *
 * @author TiBeN
 */
class CrontabAdapter
{
    private $userName;
    
    private $useSudo;
    
    /**
     * Instantiate a crontabAdapter
     * 
     * @param String $userName Optional Tell the crontab 
     * user where the adapter will try to read (by default user = runtime user)
     * @param Boolean $useSudo Tell Adapter use sudo command to connect 
     * to crontab of another user than the runtime user.
     *  
     * About sudo :
     * If you want to work with the crontab of another user 
     * of the runtime user, you can allowing the runtime user to edit 
     * another user crontab by adding this kind of line in your sudoers using 'visudo'
     * For example : user www-data want to edit waylon crontab:
     * 
     * www-data        ALL=(waylon) NOPASSWD: /usr/bin/crontab 
     * 
     * Will tell sudo user www-data can execute /usr/bin/crontab as 
     * user waylon without typing any password (required in our case) 
     */
    public function __construct($userName = null, $useSudo = false)
    {
        if ($userName) {
            $this->userName = $userName;
        }
        $this->useSudo = $useSudo;
    }
    
    /**

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。