Skip to content

Commit

Permalink
Publish new build of docs
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Dec 3, 2024
1 parent e6e636c commit 7759b7b
Show file tree
Hide file tree
Showing 17 changed files with 1,442 additions and 78 deletions.
64 changes: 64 additions & 0 deletions maintenance/bundledplugins/backup.html
Original file line number Diff line number Diff line change
Expand Up @@ -391,9 +391,73 @@
from within OctoPrint, without going via the API.</p>
<section id="create-backup">
<span id="sec-bundledplugins-backup-helpers-create-backup"></span><h3>create_backup<a class="headerlink" href="#create-backup" title="Link to this heading"></a></h3>
<dl class="py function">
<dt class="sig sig-object py" id="octoprint.plugins.backup.BackupPlugin.create_backup_helper">
<span class="sig-prename descclassname"><span class="pre">octoprint.plugins.backup.BackupPlugin.</span></span><span class="sig-name descname"><span class="pre">create_backup_helper</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">exclude</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filename</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">None</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#octoprint.plugins.backup.BackupPlugin.create_backup_helper" title="Link to this definition"></a></dt>
<dd><div class="versionadded">
<p><span class="versionmodified added">Added in version 1.6.0.</span></p>
</div>
<p>Create a backup from a plugin or other internal call</p>
<p>This helper is exported as <code class="docutils literal notranslate"><span class="pre">create_backup</span></code> and can be used from the plugin
manager’s <code class="docutils literal notranslate"><span class="pre">get_helpers</span></code> method.</p>
<p><strong>Example</strong></p>
<p>The following code snippet can be used from within a plugin, and will create a backup
excluding two folders (<code class="docutils literal notranslate"><span class="pre">timelapse</span></code> and <code class="docutils literal notranslate"><span class="pre">uploads</span></code>)</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">helpers</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_plugin_manager</span><span class="o">.</span><span class="n">get_helpers</span><span class="p">(</span><span class="s2">&quot;backup&quot;</span><span class="p">,</span> <span class="s2">&quot;create_backup&quot;</span><span class="p">)</span>

<span class="k">if</span> <span class="n">helpers</span> <span class="ow">and</span> <span class="s2">&quot;create_backup&quot;</span> <span class="ow">in</span> <span class="n">helpers</span><span class="p">:</span>
<span class="n">helpers</span><span class="p">[</span><span class="s2">&quot;create_backup&quot;</span><span class="p">](</span><span class="n">exclude</span><span class="o">=</span><span class="p">[</span><span class="s2">&quot;timelapse&quot;</span><span class="p">,</span> <span class="s2">&quot;uploads&quot;</span><span class="p">])</span>
</pre></div>
</div>
<p>By using the <code class="docutils literal notranslate"><span class="pre">if</span> <span class="pre">helpers</span> <span class="pre">[...]</span></code> clause, plugins can fall back to other methods
when they are running under versions where these helpers did not exist.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>exclude</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#list" title="(in Python v3.13)"><em>list</em></a>) – Names of data folders to exclude, defaults to None</p></li>
<li><p><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – Name of backup to be created, if None (default) the backup
name will be auto-generated. This should use a <code class="docutils literal notranslate"><span class="pre">.zip</span></code> extension.</p></li>
</ul>
</dd>
</dl>
</dd></dl>

</section>
<section id="delete-backup">
<span id="sec-bundledplugins-backup-helpers-delete-backup"></span><h3>delete_backup<a class="headerlink" href="#delete-backup" title="Link to this heading"></a></h3>
<dl class="py function">
<dt class="sig sig-object py" id="octoprint.plugins.backup.BackupPlugin.delete_backup_helper">
<span class="sig-prename descclassname"><span class="pre">octoprint.plugins.backup.BackupPlugin.</span></span><span class="sig-name descname"><span class="pre">delete_backup_helper</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">self</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">filename</span></span></em><span class="sig-paren">)</span><a class="headerlink" href="#octoprint.plugins.backup.BackupPlugin.delete_backup_helper" title="Link to this definition"></a></dt>
<dd><div class="versionadded">
<p><span class="versionmodified added">Added in version 1.6.0.</span></p>
</div>
<p>Delete the specified backup from a plugin or other internal call</p>
<p>This helper is exported as <code class="docutils literal notranslate"><span class="pre">delete_backup</span></code> and can be used through the plugin
manager’s <code class="docutils literal notranslate"><span class="pre">get_helpers</span></code> method.</p>
<p><strong>Example</strong>
The following code snippet can be used from within a plugin, and will attempt to
delete the backup named <code class="docutils literal notranslate"><span class="pre">ExampleBackup.zip</span></code>.</p>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">helpers</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_plugin_manager</span><span class="o">.</span><span class="n">get_helpers</span><span class="p">(</span><span class="s2">&quot;backup&quot;</span><span class="p">,</span> <span class="s2">&quot;delete_backup&quot;</span><span class="p">)</span>

<span class="k">if</span> <span class="n">helpers</span> <span class="ow">and</span> <span class="s2">&quot;delete_backup&quot;</span> <span class="ow">in</span> <span class="n">helpers</span><span class="p">:</span>
<span class="n">helpers</span><span class="p">[</span><span class="s2">&quot;delete_backup&quot;</span><span class="p">](</span><span class="s2">&quot;ExampleBackup.zip&quot;</span><span class="p">)</span>
</pre></div>
</div>
<p>By using the <code class="docutils literal notranslate"><span class="pre">if</span> <span class="pre">helpers</span> <span class="pre">[...]</span></code> clause, plugins can fall back to other methods
when they are running under versions where these helpers did not exist.</p>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>This method will fail silently if the backup does not exist, and so
it is recommended that you make sure the name comes from a verified source,
for example the name from the events or other helpers.</p>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p><strong>filename</strong> (<a class="reference external" href="https://docs.python.org/3/library/stdtypes.html#str" title="(in Python v3.13)"><em>str</em></a>) – The name of the backup to delete</p>
</dd>
</dl>
</dd></dl>

</section>
</section>
<section id="source-code">
Expand Down
Loading

0 comments on commit 7759b7b

Please sign in to comment.