Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Nov 21, 2023
1 parent b24da32 commit 418485a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 2 additions & 0 deletions _modules/CveXplore/database/maintenance/DownloadHandler.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ <h1>Source code for CveXplore.database.maintenance.DownloadHandler</h1><div clas
<span class="k">try</span><span class="p">:</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s2">&quot;epss&quot;</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">database</span><span class="p">[</span><span class="s2">&quot;cves&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">bulk_write</span><span class="p">(</span><span class="n">batch</span><span class="p">,</span> <span class="n">ordered</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="k">elif</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s2">&quot;cves&quot;</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="o">==</span> <span class="s2">&quot;cpe&quot;</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">database</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">()]</span><span class="o">.</span><span class="n">insert_many</span><span class="p">(</span><span class="n">batch</span><span class="p">,</span> <span class="n">ordered</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">database</span><span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">()]</span><span class="o">.</span><span class="n">bulk_write</span><span class="p">(</span><span class="n">batch</span><span class="p">,</span> <span class="n">ordered</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="k">except</span> <span class="n">BulkWriteError</span> <span class="k">as</span> <span class="n">err</span><span class="p">:</span>
Expand Down
17 changes: 9 additions & 8 deletions _modules/CveXplore/database/maintenance/Sources_process.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,13 +335,13 @@ <h1>Source code for CveXplore.database.maintenance.Sources_process</h1><div clas
<span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;CPE database update started&quot;</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">process_downloads</span><span class="p">()</span>

<span class="c1"># if collection is non-existent; assume it&#39;s not an update</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">getTableNames</span><span class="p">():</span>
<span class="n">DatabaseIndexer</span><span class="p">()</span><span class="o">.</span><span class="n">create_indexes</span><span class="p">(</span><span class="n">collection</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="bp">self</span><span class="o">.</span><span class="n">is_update</span> <span class="o">=</span> <span class="kc">False</span>

<span class="bp">self</span><span class="o">.</span><span class="n">process_downloads</span><span class="p">()</span>

<span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Finished CPE database update&quot;</span><span class="p">)</span>

<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">last_modified</span>
Expand All @@ -357,10 +357,10 @@ <h1>Source code for CveXplore.database.maintenance.Sources_process</h1><div clas

<span class="bp">self</span><span class="o">.</span><span class="n">dropCollection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>

<span class="n">DatabaseIndexer</span><span class="p">()</span><span class="o">.</span><span class="n">create_indexes</span><span class="p">(</span><span class="n">collection</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>

<span class="bp">self</span><span class="o">.</span><span class="n">process_downloads</span><span class="p">()</span>

<span class="n">DatabaseIndexer</span><span class="p">()</span><span class="o">.</span><span class="n">create_indexes</span><span class="p">(</span><span class="n">collection</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>

<span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Finished CPE database population&quot;</span><span class="p">)</span>

<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">last_modified</span></div>
Expand Down Expand Up @@ -901,13 +901,13 @@ <h1>Source code for CveXplore.database.maintenance.Sources_process</h1><div clas
<span class="k">def</span> <span class="nf">update</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
<span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;CVE database update started&quot;</span><span class="p">)</span>

<span class="bp">self</span><span class="o">.</span><span class="n">process_downloads</span><span class="p">()</span>

<span class="c1"># if collection is non-existent; assume it&#39;s not an update</span>
<span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span> <span class="ow">not</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">getTableNames</span><span class="p">():</span>
<span class="n">DatabaseIndexer</span><span class="p">()</span><span class="o">.</span><span class="n">create_indexes</span><span class="p">(</span><span class="n">collection</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>
<span class="bp">self</span><span class="o">.</span><span class="n">is_update</span> <span class="o">=</span> <span class="kc">False</span>

<span class="bp">self</span><span class="o">.</span><span class="n">process_downloads</span><span class="p">()</span>

<span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Finished CVE database update&quot;</span><span class="p">)</span>

<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">last_modified</span>
Expand All @@ -929,10 +929,10 @@ <h1>Source code for CveXplore.database.maintenance.Sources_process</h1><div clas

<span class="bp">self</span><span class="o">.</span><span class="n">dropCollection</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>

<span class="n">DatabaseIndexer</span><span class="p">()</span><span class="o">.</span><span class="n">create_indexes</span><span class="p">(</span><span class="n">collection</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>

<span class="bp">self</span><span class="o">.</span><span class="n">process_downloads</span><span class="p">()</span>

<span class="n">DatabaseIndexer</span><span class="p">()</span><span class="o">.</span><span class="n">create_indexes</span><span class="p">(</span><span class="n">collection</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">feed_type</span><span class="o">.</span><span class="n">lower</span><span class="p">())</span>

<span class="bp">self</span><span class="o">.</span><span class="n">logger</span><span class="o">.</span><span class="n">info</span><span class="p">(</span><span class="s2">&quot;Finished CVE database population&quot;</span><span class="p">)</span>

<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">last_modified</span></div>
Expand Down Expand Up @@ -1263,6 +1263,7 @@ <h1>Source code for CveXplore.database.maintenance.Sources_process</h1><div clas
<span class="n">MongoAddIndex</span><span class="p">(</span>
<span class="n">index</span><span class="o">=</span><span class="p">[(</span><span class="s2">&quot;padded_version&quot;</span><span class="p">,</span> <span class="n">ASCENDING</span><span class="p">)],</span> <span class="n">name</span><span class="o">=</span><span class="s2">&quot;padded_version&quot;</span>
<span class="p">),</span>
<span class="n">MongoAddIndex</span><span class="p">(</span><span class="n">index</span><span class="o">=</span><span class="p">[(</span><span class="s2">&quot;lastModified&quot;</span><span class="p">,</span> <span class="n">ASCENDING</span><span class="p">)],</span> <span class="n">name</span><span class="o">=</span><span class="s2">&quot;lastModified&quot;</span><span class="p">),</span>
<span class="p">],</span>
<span class="s2">&quot;cpeother&quot;</span><span class="p">:</span> <span class="p">[</span>
<span class="n">MongoUniqueIndex</span><span class="p">(</span><span class="n">index</span><span class="o">=</span><span class="p">[(</span><span class="s2">&quot;id&quot;</span><span class="p">,</span> <span class="n">ASCENDING</span><span class="p">)],</span> <span class="n">name</span><span class="o">=</span><span class="s2">&quot;id&quot;</span><span class="p">,</span> <span class="n">unique</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
Expand Down

0 comments on commit 418485a

Please sign in to comment.