Setting scheduled publishing for a site through web services (PHP)

Justin "JET" Turner's Avatar

Justin "JET" Turner

10 Jun, 2013 04:03 PM


I am just getting into web services, and I'm working on automating some of our site creation steps. I'm successfully copying an existing site, reading a folder from the site to get the site ID, then reading the site. I am then able to change the url and role assignments, but turning on scheduled publishing is giving me an error.

Invalid job time unit specified for scheduled publishingnull

Code for setting the variables

$site->usesScheduledPublishing = 1;
$site->timeToPublish = '01:00:00.0000';
$site->publishDaysOfWeek->dayOfWeek = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
$site->sendReportToGroups = 'Administrators';
$site->sendReportOnErrorOnly = 1;

I am printing the following using print_r on $site

    [usesScheduledPublishing] => 1
    [timeToPublish] => 01:00:00.0000
    [publishIntervalHours] => 
    [publishDaysOfWeek] => stdClass Object
            [dayOfWeek] => Array
                    [0] => Sunday
                    [1] => Monday
                    [2] => Tuesday
                    [3] => Wednesday
                    [4] => Thursday
                    [5] => Friday
                    [6] => Saturday
    [cronExpression] => 
    [sendReportToUsers] => 
    [sendReportToGroups] => Administrators
    [sendReportOnErrorOnly] => 1

When I compare this to a read from a site that is set properly, it all looks the same to me, so I may just be missing something in how I'm setting the variables.

  1. 1 Posted by Ryan Griffith on 10 Jun, 2013 06:20 PM

    Ryan Griffith's Avatar

    Hi Justin,

    I am seeing the same behavior with some local testing. Let me speak with the developers a bit to see if I can gather some additional information as to why this may be occurring.

    Please let me know if you have any questions.


  2. 2 Posted by Ryan Griffith on 10 Jun, 2013 07:14 PM

    Ryan Griffith's Avatar

    Hi Justin,

    After some local testing, we noticed if you do not unset the other two frequency choices, none of the frequency information is received by Cascade and an error will be thrown. This is because only one can be present during the operation.

    For example, if you want to use Every Day, or specific days, you will need to add something like the following before editing:

    $site->timeToPublish = '01:00:00.0000';

    This will remove the hour interval and cron settings from the object, leaving only the publishDaysOfWeek object. You would repeat this logic for the other options if you wanted to change to say an hour interval or cron expression.

    That being said, we did come across this known defect in which the value stored from the Web Services operation has a different case than the Edit UI within Cascade expects, so the Edit form for Site, Publish Set and Destination scheduled publishing will display the incorrect time. The View page; however, WILL display the correct time. Feel free to use the link I have provided to see if this issue has been resolved in a future release of Cascade.

    Please let me know if you have any questions.


  3. 3 Posted by Justin "JE... on 10 Jun, 2013 07:30 PM

    Justin "JET" Turner's Avatar

    Thanks, that got it working.

  4. Justin "JET" Turner closed this discussion on 10 Jun, 2013 07:30 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac